The jam-packed day has come to an end.

Your eyes are glazed over from staring at a screen for hours on end and your fingers are tired from the thousands of words you put down.

Most of all, your mind is exhausted. It has been thinking of ideas, searching for errors and edits or visualizing and drafting new stories or articles.

When you finally cuddle up in your fluffy bed and begin to drift off to sleep, the last thing you think is “its time to start working again”.

And no that isn’t quite the case, but that moment when you begin to drift off to sleep might be the most creative time of your entire day. What you do before, and while you sleep will play a major role in how much you take advantage of this creative treasure box. Here are three things you can easily start doing to use sleep to hack your most creative mind.

1. Put a notebook by your bed.

As the day comes to a close your frontal cortex (the location that processing dopamine) has started to get tired, and you are no longer producing these high functioning chemicals through your body. Things are shutting down, and other less dominating parts of your brain have started to take control.

Think of your brain like a business meeting, the dominating boss has finally left the room and now the other employees feel comfortable sharing their ideas. And this is when creativity you didn’t know existed steps forward.

Just when dozing off, mid-sleep, or just as you wake up these ideas will be flowing in and out of your mind. Instead of letting them run away, jot them down.

After an idea struck I found myself thinking one too many times “this is a great idea, there is no way I won’t remember it in the morning”. Only the next day I would wake without recall and instead have a faint feeling that something great had happened, like deja vu, or one too many margaritas.

To combat this, I purchased a notebook and a pen designated for my bedside ideas to easily and quickly capture anything that would come to me.

I don’t suggest using a phone, although you can, but the light will wake you more than you or you possible sleeping partner would enjoy. With a notebook, you can scribble ideas down in the dark and read the next morning.

Maybe some of the ideas and notes won’t make sense like “strawberry toaster pants” but some might be great enough to change the direction of your content or create an entirely new character in your story.

2. Think about your desired topic before falling asleep.

Whatever you learn or think about just before falling asleep is often what you will dream about, and allow your mind to focus on.

If you ever find yourself with writer’s block or feel stuck on an idea, think about it before you lie down to sleep. A study found that people who thought about a topic or problem just before going to sleep were 50% more likely to dream about it and for 70% of these dreamers, their dream contained a powerful solution to the problem.

So put on your thinking cap one last time before you end the day and allow your dreams to do some of the work.

If you are reading this and think to yourself it will only lead you to toss and turn all night wide awake thinking about the problem or topic, then do something else just after. I like to pick up a book to read or focus on taking soothing breaths. These two actions will help calm your mind while still keeping it focused.

3. Wake yourself up mid-sleep.

Okay, this doesn’t sound like that much fun, but sometimes it’s worth it. Both Salvador Dali and Thomas Edison would use this technique to create art or mull over an invention. The technique is to jolt yourself awake, ideally during REM to pull ideas from your dreams immediately into action. It is pretty impressive that these creators discovered this trick before science was able to explain what was actually happening.

Why does this idea work? A lovely science term called “pattern recognition”.

This phenomenon occurs when the brain is in a relaxed enough state to create brand new connections and neural pathways. When you can relax, you can create. By waking yourself up you are pulling yourself out of this relaxed state and now, consciously using this mental mind frame to fuel creative action and thought.

Don’t let the six to nine hours in the night when you are unconscious feel like a waste, sleep is vital for creativity and on top of getting rest, you might find your next big idea or story!

Sleep tight and let all those creative ideas bite.

This article first appeared in Medium.