Regarding your memories:
I have written the following idea before and it is appropriate here as well:
Rav Nachman says getting hirhurei zenus is a great zechus. The reason is that it gives a person the opportunity for teshuva and proper tikun for the past aveiros. After a person rectifies his aveiros of pgam habris by refraining in action, Hashem sends him these hirhurim to give him a chance for real teshuvah. He says that so many people get down and depressed when they get these thoughts and feel bad about themselves. But these thoughts are there in order for a person to chase them away and be zoche for teshuva. So just realize that your current challenges are intended for you to attain teshuvah shleima. Knowing this can prevent unnecessary hindrances and should invigorate you for eternal growth.
In terms of practical advice:
1. Like Guard says: Daven, Daven and Daven
2. When you get these thoughts, try to learn a bit. You can read an example of my personal struggles how I used this idea
by clicking here.
3. For some people that is not so practical, so the sefer chasidim says (brought down by taharas hakodesh) to just simply talk to someone. It can be about anything
4. Say the following:סך ספיאן אגזנא קרדינא תקיל פוק פוק דאבוהי קדישא דשבתא הוא which means:"look, I was created from great people, you stumbling block. Now get out, get out, and do not bring me to think about aveiros".
Keep up the hitbodedut , it takes time to unravel the inner traits that require tikun and figure out how to correct them.
We love watching you grow!