The origin of dreams