Well, AFAIK it's for processing of impressions. When I'm programming or do research, I sleep a lot. More than once I had perfect solutions for problems in the early morning. The unconcious brain has the most processing power and AFAIK it's being used most when asleep.