I side with lord soth's thoughts on the matter, but not the harshness

In my (extremely) humble opinion, dreams are there to 'commit' your thoughts and rearrange associations.
And the subconscious does that by running it over in sometimes vivid detail - resulting in REM and dreams.