The fact that you're not completely freaking out about these thoughts is a good thing. It shows that although you're having them, you're able to control your emotions towards them to an extent.
And if you were going to act on the thoughts, you wouldn't go onto an online forum. You'd just do it.
Don't avoid thinking about them, but don't make an effort to seek them out either. If a thought comes, let it stay in your mind for a while, just floating there. And then start thinking about something else. Everyone in the world has intrusive thoughts, it's just that they don't let it bother them.
You could also try the 'Stop' technique-saying 'Stop!' out loud or under your breath the moment an intrusive thought comes in.
Idk about the medicine but could you maybe talk to your doctor about it?