I can't have coffee or caffine in the afternoon at all, else I'll be up in the middle of the night. I have two cups in the morning; maybe a third, but, that's it. I'm on my third day without smoking again. Smoking makes me cough, and wakes me up. So, both cause me sleep disturbance.
Exercise is very good, but, there is a caveat. Do *not* exercise within three-four hours of bed time. It stimulates you. So, you won't be able to sleep if you exercise right before bedtime. But, regular exercise is known to help you sleep sounder. So, do get into a routine.
I use the computer without any problem. In fact, too many nights, I fall asleep with my laptop on my lap!
Good luck to you. There's some information about sleep hygene on the insomnia forum. I hope you'll take a look over there before you go for medication.
Shalom!