Jet lag, the obnoxious sidekick of long-haul travel, is always waiting at the arrivals terminal, ready to hand out that second day of a bad hangover feeling. Many of us are willing to go to great lengths to dodge that pathetic prize package of drowsiness, irritability, headaches, indigestion, and confusion. Luckily for savvy jetsetters, the science exploring how our body’s routines affect our overall health has come up with helpful travel hacks to reset our internal clocks at a faster rate. Timing really is everything. Here’s how to use the science of routine to beat jet lag.

Note: Consult your doctor before making changes to your sleep and diet routine, or taking supplements.

How jet lag destroys your body’s rhythm

The body is always open for business. Each shift has a specific job and there are several “clocks” that run those shifts, dictating all of our functions and keeping us healthy. The sleep and wake clock is the master clock (circadian rhythm), telling the body’s day shift when to start its activity and telling the overnight shift when to take over and do repairs during sleep. This routine, this shift switch, is so crucial that the body even sets backup alarms in other organs, such as the digestive cycle and skeletal muscle activation. If we mess with our sleep and turn day and night upside down, our backup clocks will try to kick in and signal the activity shift (awake) and repair shift (sleep).

The circadian rhythm is initially set by exposure to daylight and darkness and then is hammered into instinctual habits based on time of day. Once it has a habit, your body can wake around its normal time, for a period of days, even without sunlight. But when time drastically changes, such as after a long flight, the stunned circadian rhythm is thrown off and is frantically struggling to catch up. That master clock that runs all of our routines can only naturally reset at the average rate of an hour a day. For instance, if you have a six-hour time change, your biological rhythms aren’t back to fully normal for six days. In the meantime, we’re feeling the effects, most notably in our immune systems and thought processes that are definitely not their best selves.

How to hack your routines before and during your time zone jump

The key to beating jet lag is rapidly resetting our internal clocks faster than the natural rate. To have the greatest chance of avoiding jet lag, we need to start adjusting our habits before and during our time jump.

1. Gradually switch to your destination’s time before the trip.

Sleep is a power player with jet lag. Not only do our bodies work best with seven to nine hours of sleep, but we best use that sleep when it comes at a predictable time. Our bodies know to release melatonin, the hormone that regulates sleep cycles, in sync with the daily shift from day to night. For most people, melatonin is telling the body to sleep starting around 9:00 PM and fading out around 7:30 AM. When you change time zones, melatonin release stubbornly resists the change in light and wants to stick with time, leaving you groggy and disoriented in the middle of an afternoon and wide awake before dawn. But if we break that time-based sleep habit before we leave, it will be much easier to reset our routines with light when we arrive.

The most basic reset schedule is this: A week before you leave, start moving your meal and sleep times by either 30 minutes or an hour each day. If you’re heading east, go to bed and wake up earlier and earlier each day. Heading west, start pushing your wake and sleep times back as much as you reasonably can. Even small shifts make a difference before departure. Online calculators, such as Jet Lag Rooster and British Airways’ jet lag fighter, as well as apps like Timeshifter, do the math for you and provide detailed, individualized plans.

2. Fast for at least 12 hours before arrival.

I’ve often found myself eating airline meals that I’m not hungry for and wishing for more snacks. Boredom and habit strike again. I told myself it was alright, as I was just syncing my meal-time with my destination and cleverly fighting jet lag. Turns out that was wrong, and a missed opportunity to drastically cut symptoms up to seven times the rate of my normal routine. The answer: Skip the meals entirely.

A streamlined version of the Argonne diet for beating jet lag, the anti-jet lag fast disrupts and re-syncs the master clock without all the pre-trip prep work. When a body is fasting for at least 12 hours, the back-up “digest clock” suspends the circadian rhythm to conserve energy, effectively stopping time-based routines. When we eat, we start the clock again and the body pays attention to daylight and darkness to reset the clock instead of time. Simply, if you fast, your body won’t care as much what time it is back home but will instead pay attention to the light cues when you’re at your destination, making jet lag recovery faster. Watch your fasting start time before departure to get at least 12 hours and pass on those flight meals and snacks. Instead, jump-start your trip and your internal clock with a good meal when you arrive.

How to hack your routines upon arrival

While jet lag is best fought before you arrive, there are still several things you can do once you’ve reached your destination to demand that your body shifts quickly. The road warrior advice of making yourself stay up and avoid naps on the first day is still useful and necessary. But these other methods will also help you get a healthy reset in the first few days while feeling less miserable.

1. Soak in the sunshine.

The science of health routines is beating us over the head with this main truth: You need natural light to reset and feel like yourself. If you need to wake up earlier, get outside and get natural light as soon as possible. If you need to stay awake for longer, make sure you are out and moving in the late afternoon sun all the way to sunset. If you’re at a location that lacks radiant sunshine, never fear, even a gloomy, cloudy sky allows for natural light and it can still help reset your clock.

2. Get moving.

Exposure to light is good; movement in light is even better. Break out of an in-room or in-hotel workout routine and get as much light as possible, telling your brain that this is waking time. Fitness and nutrition specialists also suggest that, when it comes to sleep, do aerobic efforts in the morning and anaerobic activities, such as weight lifting, sprinting, and any intense exertion, later in the day.

3. Get your calories in early.

Eat the bulk of your calories earlier in the day and try to be done eating by 6:00 PM or 7:00 PM at your destination when you first arrive. Even our helpful livers have clocks to turn on the conversion of calories to energy by day and to shut down and store calories at night. Pushing our livers into overtime work with full meals late in the evening throws all of the other functions off tempo too, making it even harder to reset to a new time. (We can see this all on a smaller scale with the “weekend social jet lag.”) Once the rest of the body resets to the new time zone, the liver will be able to be more flexible with late meals and free-flowing libations.

4. Switch to local bedtimes.

If you haven’t already, the sooner you can switch your sleep to local time, the better for your immunity, metabolism, and ability to think. The first nights of your arrival are key to this, even if going to bed “earlier” or staying up “later” to fit your bedtime in local time is difficult and uncomfortable. Good sleep hygiene routines can help trigger sleepiness even if the timing is weird. Things like limiting screen time before bed, keeping your room dark and cool, not skipping bedtime hygiene routines, reading with gentle light, listening to music, and dedicating the bed to sleep and sex only are additional ways to get your sleep back on track.

5. Use melatonin supplements.

While it may be 1:00 AM in the morning where you are, if your recently arrived body thinks it is 7:00 PM in the evening, it is still resisting releasing melatonin. An over-the-counter supplement of the widely studied and accepted melatonin (often found with the vitamins) can help bridge the time gap until your body adjusts. Physicians recommend that melatonin should be taken at the local bedtime and 30 minutes prior to the intention to sleep. Research notes that doses between 0.5 milligrams and 5 milligrams are effective, with doses above five having no additional effectiveness. Avoid alcohol when using melatonin and consult your doctor with any concerns.