Here is an article I found on the internet about mastering your mind and thoughts. It gives different methods and techniques to controlling your thoughts. Check it out if you want to have more control of your mind. Here is a small paragraph from the article that really got my attention
"Just remember that in life there are no mistakes only lessons. Learn not to judge situations as either good or bad, but just as a learning experience. If you truly learn from it you will not commit the same thing you label as a mistake. If you keep committing the same mistake you will know you have really not learned from the experience. You are still allowing your old ways of thinking dictate how you act in a given situation."