Dreaming can occur in both REM and non-REM sleep. REM sleep is characterized by rapid eye movement, muscle atonia, and often vivid dreaming. The brainstem is very active during dreaming, sending information forward, while the prefrontal cortex which controls reasoning is deactivated. This may explain why dreams can be bizarre but we don't notice during the dream, and why it can be difficult to remember dreams. A major theory is that dreaming serves an evolutionary purpose of practicing responses to threats from our ancestral environment like being chased by animals.