When it is painful to remember the past, it is better to simply repent of what had been bad, and think no more about it. In order not to despair or be enfeebled by it, 'remember the examples of God's great mercies to great sinners. The main thing: do not condemn, do not envy, know yourself and be with God.'
Observe your thoughts, and beware of what you have in your heart and your spirit, knowing that the demons put ideas into you so as to corrupt your soul by making it think of that which is not right, in order to turn your spirit from the consideration of your sins and of God.