Coffee is a wonderful thing. So are naps. But have you ever wondered what would happen if you combined the two?

A group of researchers in Japan did just that—and found that coffee naps were more effective at combating daytime sleepiness than non-caffeine naps.

Basically, when you combine coffee and a nap—you drink a cup and then get quick shut-eye—you can complete the first two stages of the sleep cycle in the same amount of time it takes for caffeine to be absorbed by your body. The caffeine acts as a natural alarm, waking you up refreshed with more clarity and energy, ready to focus on the next activity.

That afternoon slump you feel? It’s real. Your blood sugar and energy start to dip after lunchtime. So does your core body temperature, triggering the release of the sleep-inducing hormone, melatonin. This is part of your body’s circadian rhythm that responds to environmental cues, like daytime and nighttime, and tells your body to feel sleepy or alert.

The National Sleep Foundation says the optimal time for most people to nap is five hours after waking up. So, if you rise at 7am, your ideal nap time is 12pm (yep, right after lunch.)

No wonder most of us ache to grab a big cup of coffee. Or a nap.

When you’re awake, the neurons in your brain produce adenosine, a byproduct of brain activity that is constantly monitored by your nervous system. When high enough levels are reached, adenosine plugs into receptors to make you feel tired. Caffeine is chemically similar to this compound and fits into the receptors that are normally filled by the adenosine, effectively blocking them and tricking your body into thinking that it’s not yet time for sleep.

A sleep cycle is comprised of four stages and takes about 90 minutes to complete, making that the perfect amount of time for a nap. But when you’re a busy parent, it’s hard to carve out uninterrupted time for that long. The good news is that the first two stages of sleep are short, light and only take about 20 minutes to complete, so if you can squeeze in 20 minutes of sleep, you’ll complete the first two stages of the cycle without falling into the last two, more intense ones.

Need more proof? A study from NASA found that a 20-minute snooze enhances motor skills and attention. In the study, researchers found that long-distance pilots who napped for 25.8 minutes were 50% more alert than their non-napping counterparts and performed 34% better on certain tasks.

Of course, naps and caffeine late in the afternoon can have a negative effect on your actual nighttime sleep by delaying the onset of sleep or disrupting sleep regulation, when you transition between sleep and wakefulness. In general, caffeine lasts about 5-6 hours in the body before wearing off. And it is worth noting that caffeine can affect different people in different ways, so it’s important to know how it affects you personally.

For women taking birth control pills or those between ovulation and the beginning of menstruation, it may take twice as long to process the caffeine. Additionally, though many studies have listed the benefits of napping for mama and baby, be sure to speak with your doctor if you’re pregnant.

Bottom line: Sometimes multitasking has its benefits. Since naps reenergize you and caffeine helps you stay awake, combining them for 20 minutes of self-care can give you the boost you need to make it through the rest of your day.

A version of this story was originally published on October 7, 2019. It has been updated.