A quick explanation of what thinking is:
Abstraction: Taking information from memory or from our senses (example, vision, audition and so on)
Asimilation: Understanding the information.
Saving: Saving the information in memory.
Now, memory is not a pendrive, it's a "living" stuff in your brain, it works, it have organization, it changes and it moves so to speak.
Structure of memory:
Self image: This is the image of you, it is build to simulate you in psichic reality, it changes, it have values and it's complex.
Surounding: This is, so to speak a representation of the fisical enviroment, it constantly changes, it have rules.
Taste: I'm not going to explain this, not even a little bit, but I might adress it, so I wrote it it so you know there's more in the structure of memory.
Basically, memory emulates reality by having this "self image" and the surrounding. So whenever you get hit, insulted, kissed, promoted, degraded, or whatever, it will happen something similar in your brain. From the learning of such experiences (understand yourself as a laboratory rat subject of punishment and rewards) you will create "taste" which will help you to prevent intuitively negative events, and will help you to LIE to yourself to benefict your self image.
Now, self image is divided in parts, like appealing, strenght, age, intelligence and so on... each part and self image as a whole have levels. Imagine a recipient that can be filled with self-steem. This is extremely vulnerable to changes.
Finally, whenever you receive good or bad stimuli, self image is affected, and its values change, it is affected by the emotional system, which is basically like this:
Constructive/Destructive: It rises or lowest self steem levels.
Positive/Negative: Impulses you to act, it can be to approach to a source, or to go away from something that is negative to your self image.
Now, this 2 types of emotions can mix, and work along with "taste" as a psychic structure. So all emotions have a porpouse, I'm gonna stop now and leave room for questions. Then I'll go on.
NOTE: This is from my not yet published book, and I will not offer more information that what I want, nevertheless I'll try to answer every single question.