The functional role of dreaming in emotional processes