Contrary to popular belief, sleep is not passive — and while it may seem uneventful to you, your brain is actually working pretty hard.

Because, while you’re just lying there, your brain cells scramble to progress through a series of important steps, all of which are crucial to your ability to tackle whatever it is you’re doing in the morning. This series is called a sleep cycle, and the average person should ideally go through about five of these each night.

A sleep cycle consists of five steps, which are in turn divided into two categories: REM sleep and non-REM sleep. REM sleep, or rapid eye movement sleep, occurs toward the end of each cycle and is typically the stage for our most lucid dreams. Conversely, non-REM sleep is generally lighter and dreamless, save for a few fragmentary images here and there.

But to truly understand what goes on in the brain while you sleep and dream, it’s useful to examine each step.

Stage 1

At this stage, sleep is very light and can easily be disrupted. Mental activity begins to slow down, with brain waves switching to a form called theta-band activity. This wave pattern has been described as a deep, meditative state marking the threshold between consciousness and the “subconscious.” However, intermittent bursts of alpha activity, or quiet wakefulness, often give you the sense that you’re still awake.

In fact, a landmark study performed in the 1960s found that people who wake up at this stage usually don’t realize they’ve been asleep. "Investigators asked subjects aroused out of various stages of sleep whether they considered themselves asleep,” the researchers wrote. “Only about 10 percent of those aroused from stage 1 said that they had been asleep."

Stage 2

Next, eye movement stops and brain waves become slower, with alpha activity shutting down entirely. The brain will begin to produce “sleep spindles” — brief bursts of activity that last for about half a second before dying down. The average adult will spend most of her night in this stage.

Stage 3 & 4

These stages are very similar — so much so that some consider them to be one and the same. Collectively known as deep or slow-wave sleep, these stages are characterized by extremely slow brain waves called delta waves. Deep sleep sets the stage for some pretty strange phenomena: nightmares, sleepwalking, and somniloquy — or sleep-talking.

Stage 5 (REM sleep)

Finally, we enter REM sleep, where things start to get even weirder. Our breathing becomes shallow and irregular, and our limb muscles become temporarily paralyzed. Our eyes begin to jerk in various directions. This is also the stage where the dreams we actually remember tend to take place.

REM sleep is very important, and the brain will often deploy “safety measures” to ensure it isn’t disrupted. For example, the sound of an alarm clock or phone may be incorporated into the dream and transformed into something else. A similar phenomenon is false awakening, in which the dreamer will dream that she is awake — a “dream within a dream.”

Psychologists and neuroscientists are not sure why the brain goes to such lengths in preserving REM sleep. Sigmund Freud famously claimed that the dreams we now associate with REM allow us to resolve unconscious urges we suppress when we’re awake. A more recent theory holds that these dreams reflect the new memories that are consolidated and integrated into the mind during stage 3 and 4.

A lot of work, without much effort on your part.