Your body is a well-oiled machine. If you want to keep it running smoothly, you have to keep it properly fueled. In the same way you would only fill up a fancy sports car with premium unleaded, you want to make sure that you’re giving your body the gas it needs for maximum performance.

This is especially important when it comes to exercising—both before and after.Working out uses up a lot of energy, so it’s crucial to fuel up prior to hitting the gym. A great food source for energy are complex carbohydrates, like whole grains, trail mix and bananas. They break down easily into glucose, which is your body’s main energy source. Complex carbohydrates take longer to break down than simple sugars (like white bread and rice), so you won’t get a sugar crash right in the middle of your second set of crunches.

COLUMN: Eat Well and Exercise to Prevent Cancer

Timing your pre-workout meal is important: If you haven’t eaten for a while, you won’t have the energy you need to exercise safely and effectively; but if you just ate, your body may not have had time to adequately metabolize the meal (not to mention the icky feeling of food sloshing in your belly while you’re trying to Zumba). Each of us is different, but ideally you want to have a complete meal three to four hours before working out, or a snack two to three hours beforehand, or fresh fruit or a sports drink one hour before.

A note for you morning exercisers: Don’t just pop out of bed and hit the gym! At least grab a piece of fruit before setting out. If you don’t, you’ll literally be running on empty. Between the time you finished dinner the night before and when you wake up, you may have been fasting for nearly 12 hours. They don’t call it break-fast for nothing!

And what about after working out? What you eat when your body is depleted of its energy resources is just as important as what you eat beforehand. This is a time of recovery, and the right foods can make all the difference for ensuring that all the good you did has a lasting effect.

For one thing, you need carbohydrates to replenish your glycogen levels. Glycogen is how carbohydrates get stored in your muscles, so that there’s always sugar on hand when you need calories to burn. Think of it like an energy bank. When you work out, you take out a major withdrawal, and afterward it’s time to balance the account. You need to eat protein, too, which works with these carbs to restore glycogen, while also building and repairing muscle.

Try munching on foods like lean turkey on whole grain bread, sushi, yogurt or nuts after you cool down. Ideally you want to eat within 30 minutes, but definitely within two hours to maximize the restorative effects.

READ MORE: Six Foods That Could Save Your Life

And last, but most certainly not least, fueling your body correctly for peak exercise performance means getting enough fluids!  Don’t forget to hydrate, hydrate, hydrate. Always have a water bottle with you and remind yourself to stop and sip from time to time. And make sure that you drink up afterwards as well, to replenish the fluids you sweated out while you were working out.

Think of it this way: Follow these simple tips and you’ll always have a full tank to go on.