Have you been feeling sluggish at the gym lately? Even if you’re doing everything right with your diet (that is, fueling up appropriately before and eating well after your workouts) you might benefit from focusing on a few key nutrients.

Here are three to zero in on, why they can help you build a leaner, fitter figure, and how to make sure you’re striking the right balance.

Vitamin D

There are numerous studies about the benefits of vitamin D for athletes, including a reduction in injury risk, and improvements in muscle function and power. One study found that compared to those with deficiencies, athletes with adequate blood vitamin D levels fared better on tests related to muscle force and velocity. Another found that supplemental vitamin D significantly curbs the amount of time cells need to replenish energy after muscle contractions, which means better muscle efficiency, and delayed fatigue. And a brand new study from Queen Margaret University in Edinburgh concludes that vitamin D supplements can improve exercise performance and lower the risk of heart disease. Researchers gave 13 healthy adults either 50μg (2,000 IU) of vitamin D or a placebo daily for two weeks. Those who received the real deal had lower blood pressures, lower levels of the stress hormone cortisol, and were able to cycle 30 percent further in the same amount of time with less exertion.

RELATED: 21 Worthless Foods a Nutritionist Will Immediately Cut From Your Diet

How to get enough

Vitamin D’s nickname is the “sunshine vitamin,” because exposure to the sun’s ultraviolet (UV) rays triggers its production in the body. But where you live, the time of year and day, cloud cover, smog, sunscreen, and clothing all affect UV exposure and vitamin D production, so you can’t rely on the sun as your sole source. Unfortunately, there aren’t many foods that are naturally rich in vitamin D. The top sources include salmon, tuna, whole eggs (the vitamin D is found in the yolk), and mushrooms.

Because you may not eat these every day, or eat enough of them to meet your needs, a supplement is often needed. But more isn’t necessarily better. Too much vitamin D from supplements has been linked to high blood calcium levels, which can cause kidney and heart damage, and mental confusion. Another recent study also found that excess vitamin D upped the risk of dying from a stroke or heart disease.

To determine your proper supplement dosage have your blood vitamin D level tested. Depending on your level your doctor may recommend anywhere from 400 IUs, to 2,000, or even more for a short period of time to build up your stores. In my experience with athletes, correcting a deficiency can have a huge impact on how you feel.

RELATED: 10 Best Foods for Your Heart

Magnesium

This vital mineral, the fourth most abundant in the body, is involved in more than 300 metabolic reactions. In addition to helping maintain muscle and nerve function, heart rhythm, blood pressure, and blood sugar regulation, magnesium is needed to make DNA, so its crucial for building stronger muscles and bones. In other words, it’s crucial for optimal health as well as athletic performance—yet most people can’t name the top sources.

Among athletes, a higher intake of magnesium has been shown to significantly improve strength, oxygen uptake, energy production, and electrolyte balance, and even a marginal shortage can interfere with sleep, which is crucial for exercise recovery.

Unfortunately about 75 percent of Americans consume less than the recommended intake of magnesium, so there’s a good chance you’re falling short, and testing for magnesium status isn’t as easy as testing the same for vitamin D, since less than 1 percent of total body magnesium is found in the blood. Symptoms of a serious deficiency are usually noticeable, like poor appetite, nausea, numbness, tingling, and abnormal heart rhythm, But the signs of a more subtle shortage are a bit harder to pin down. Things like fatigue, may be attributed to exercise, or too little sleep, which is why magnesium shortfalls are often “invisible.”

RELATED: 11 Ways to Boost Your Energy With Food

How to get enough

Too much caffeine, alcohol, and sugar can all reduce magnesium absorption, or cause it to be excreted from your body, so curbing this trio is just as important as upping your magnesium intake. Few foods supply a significant portion of your daily magnesium needs in just one serving, so a healthy, varied diet is key.

Good sources include almonds, avocado, beets and beet greens, brown rice, buckwheat, cashews, dark chocolate, millet, pulses (beans, peas, and lentils), pumpkin seeds, quinoa, sesame seeds, spinach, and sunflower seeds.

If you’re considering a supplement don’t go much above 350 mg daily, unless your physician has prescribed a higher dose. Your body has a built-in mechanism to prevent overdosing on magnesium through food, but a high supplemental intake can lead to an excess, and trigger side effects, including diarrhea, nausea, abdominal cramps, or in very high doses dangerous toxicity. In other words, you can get too much of a good thing!

Vitamin C

You’ve heard about the immune supporting benefits of vitamin C. But this essential nutrient also supports exercise endurance and recovery. A higher blood level of vitamin C Vitamin has been shown to boost fat burn, both at rest and during exercise, which can delay fatigue and lengthen workouts. And vitamin C is required to make tendons, ligaments, cartilage, and bones, so it plays an important role in healing the wear and tear exercise puts on your body. Getting the right amount means you can make the most of your sweat sessions.

RELATED: 12 Foods With More Vitamin C Than Oranges

How to get enough

Citrus fruits and bell peppers, especially red, are top sources, in addition to broccoli, Brussels sprouts, kiwi, strawberries, and cantaloupe. Taking in at least five servings of produce a day that includes rich sources is enough to saturate your body’s tissues (meaning any more will be excreted).

But if you do opt for a supplement don’t go overboard. Too much vitamin C, from high dose supplements, can have a pro-antioxidant effect, which increases exercise-induced stress. The Tolerable Upper Intake Level, or UL (essentially the maximum advised daily intake) for vitamin C it’s 2,000 mg a day. While some people may be fine consuming more than this amount megadoses have linked to bloating and digestive upset, diarrhea, nausea, vomiting, heartburn, headaches, insomnia, and even kidney stones.

Cynthia Sass, MPH, RD, is Health's contributing nutrition editor. She privately counsels clients in New York, Los Angeles, and long distance. Cynthia is also the sports nutrition consultant to the New York Rangers NHL team and the New York Yankees MLB team, and is board certified as a specialist in sports dietetics.

This article originally appeared on Health.com.