This article is sponsored by Starbucks, which is hiring baristas nationwide here.

Whether you’re working on a group project at the last minute or you just totally dropped the ball on finishing a long research paper, it’s not uncommon to find yourself in the difficult situation where you’re forced to pull an all-nighter.Want to make sure that your all-nighter is as productive as possible? Here’s your guide to getting everything done—and maybe even finishing with a little time before your 9 AM class to spare.

Step #1: Plan Your Night Beforehand

Pulling an all-nighter is intimidating, especially because you have so much to get done and so little time to do it. The great paradox, however, is that having the whole night ahead of you also means it’s easy to procrastinate.

How can you stay on track and not panic when you see the first morning light? Plan your night before you begin.

For instance, saying, “I need to write a 20-page research paper tonight” is incredibly intimidating. Instead, you’ll want to break it down into steps and how much time you can allot for each, like researching, outlining, writing, editing, citing, proofreading, and printing.

If the task at hand still feels overwhelming after breaking it down into smaller steps, you can use these easy questions to get yourself on track.

Photo courtesy of WayUp

It might seem like overkill, but when you think about every part of the process, you’re less likely to get flustered or distracted.

Step #2: Caffeinate Efficiently and Snack Up

At the first mention of the term “all-nighter,” you might be tempted to find the nearest Starbucks, order 12 shots of espresso, and start downing your drink. However, caffeinating for an all-nighter requires some next-level finesse so that you stay awake and alert but aren’t jittery and on the verge of crashing an hour later.

First, steer clear of caffeine during the day leading up to your all-nighter. When you constantly have caffeine, it decreases its effectiveness, meaning that you’ll need more and more of it to stay awake. Instead, avoid caffeine all day, and buy some in your favorite form (coffee, tea, energy drink, or otherwise) at night.

There’s also no need to start pounding the coffee right away, either; when you start feeling yourself getting sleepy or sluggish, take some sips. The trick is to treat this like this like an IV drip: As the old story goes, slow and steady wins the race.

Study snacks are tricky because you need to be careful: If you have too many carbs, you’ll get sleepy, but without enough fuel, you may not stay alert.

What kinds of snacks should you be using to fuel your body? Here are several protein-rich options to consider that aren’t too tricky to buy or make:

-Starbucks Protein Bistro Box

-Hummus and veggies

-Apple slices with peanut butter and granola

-Avocado toast

-Roasted cashews or pumpkin seeds (add your favorite spice for a kick)

The big struggle, however, is not letting your food turn into a distraction: Have all of your food ready beforehand, and portion how much you’ll eat before you begin. Otherwise, you’ll be running to your kitchen or late-night campus dining options more than you’d like to admit.

Step #3: Move Every Hour

Want to keep yourself from falling asleep in the wee hours of the night (er, morning)? Get up and move every 60 to 90 minutes. You don’t have to do a bootcamp workout or run five miles, but take three to five minutes to get up, stretch, do some quick yoga moves, and focus on your breathing.

Another potential trick to try: Standing desks are all the rage nowadays, so if you have the ability to stand up while you work, it’s worth a shot since it’ll keep your blood pumping.

Step #4: Get the Right Tunes

If you want to get psyched, create a playlist that’ll keep you motivated throughout your entire all-nighter; it really makes a difference.

Don’t have time to make your own playlist? Take some tips from the people at Starbucks who know how to make a great coffeehouse track, and use this expertly curated playlist for your late nights in the library (hint: this playlist is also collaborative, so you can add your favorite study tracks!):

Some people don’t like working with music (after all, it can be distracting if it’s too loud or just not the right song), so if you like working with some sounds in the background and can’t stand silence, there are definitely ways to get what you need.

One example? Try Coffitivity, an ambient noise generator that makes you feel like you’re in bustling cafes and busy spaces without actually having to be there. For example, use “University Undertones” for “scholarly” cafe background noise, or listen to “Morning Murmur” for the slow build of a morning at a coffeeshop.

Step #5: Find the Right Space

If you do work in your dorm room or apartment, chances are you’ll be tempted to curl up on your bed or comfy couch. Instead, look for a study space that you know will be open all night, that’s free from distractions (like noise and people), and that has any amenities you may need throughout the night (like a bathroom and a printer).

A couple of great study spaces include the library, any IT labs on campus, the student center, or even a random classroom on campus. Also, many college campuses allow students to reserve classrooms, so if that option is available on your campus, use it so that you can work alone in your own academic space.

While you should definitely avoid all-nighters when you can, these tips will keep you alive and alert as you power through. The good news? There’s a long nap with your name on it. You just have to make it to tomorrow.

Starbucks is dedicated to helping 25,000 employees graduate by 2025 by providing full tuition reimbursement for a bachelor’s degree via Arizona State University’s online program. You only have to work an average of 20 hours per week to access this exciting benefit as well as many others (free drinks, free food, health coverage, 401k, stock, and a free Premium Spotify account to name a few!). You can learn more about the Starbucks College Achievement Plan here.

Starbucks Barista-Approved Drink Combo: “My favorite drink that’s not on the menu is an undertoe (although I have heard it called other things). You pour cold breve (latte with half-and-half) with vanilla, and layer two shots of espresso over the top using a spoon. Layering the drink makes it easy to drink fast, and it’s perfect for a quick pick-me-up!”

This article was originally posted on the WayUp Blog