It is scientifically proven that REM sleep helps solve problems. I'm not saying the other things don't play a part, but if you are giving a problem and you get REM sleep you do statistically better on it afterwards then people who had the same amount of time to think about it but did not get REM sleep.