You were flying high at spin class, tapping it back like a pro because, of course, you never coast. The morning after? You feel like you came in second place in a butt-kicking contest.

Whether you are a fitness novice or a seasoned exercise maven, we’ve all felt the burn of a tough workout. That second and third-day soreness can derail your motivation for the rest of the week and make you gun-shy about the next time you exercise. Luckily, there are a few steps you can take to ward off muscle soreness before it starts—and measures you can take afterward that’ll help you cope without needing a week off. Here’s what you need to know.

Hydrate

Hydration is instrumental to surviving tough workouts. Luke Greenberg, a physical therapist and co-founder of MotivNY, believes the first step is to drink more water. “Most people can encourage the flushing of waste out of your muscle tissue by drinking water. Try to take in 32 ounces of water for every 30 minutes spent exercising, and then eight ounces per hour after that.”

Stretch and foam roll

Try to fit in about 15 minutes of recovery for every hour of exercise you do. However, that doesn’t mean just haphazardly lolling around with your foam roller. “I see a lot of people lying on the foam roller for 15 minutes thinking that is a warm-up or recovery, but it does little to produce lasting change,” Greenberg says.

Sure, stretching and foam rolling are great ways to ensure you feel more flexible and less fatigued. But Greenberg also recommends integrating dynamic stretches into your warm-up to ensure that your body is prepped and ready to take a beating. Try some bodyweight lunges, butt kicks, and high-knees to loosen up before you get going—do at least two 30-second sets of each exercise before you work out.

After spin class, in particular, you should mobilize your hips and legs to make sure you didn’t lose mobility during the workout, Greenberg says, by doing light stretches or even yoga moves like downward dog and opening at the hip, pigeon pose, or simply by touching your toes. “So if you could touch your toes before spin class but can’t after, you’re potentially having negative affects on your body’s ability to maintain normal range of motion,” he says. Continuing to mobilize before and after the workout with dynamic movements, foam rolling, and hydration will prevent this from becoming a regular occurrence.

Change your intensity

With all of the touted benefits of conditioning classes, it is tempting to push yourself for the sake of a good burn. However, Greenberg says that if a spin class leaves you sore for more than two days, don’t get back on the bike more than once a week until your body adapts better.

Instead of toughing it out through the pain, Greenberg recommends a change in the intensity, such as a lighter cardiovascular exercise for even just 30 minutes, which will enhance blood flow and help your recovery. “Consider doing another lower intensity or lower volume exercise session that uses the same muscles to get stronger,” he says. If spin class leaves you sore for a week, maybe light lower body kettlebell routines or TRX will help you build up the strength you need to feel better, tolerate soreness, and move forward toward your fitness goals.

Surviving workout soreness really boils down to muscle care through hydration, preparation, and recovery. With proper care, and as your endurance builds, it will become easier to tolerate a good butt-kicking. If you are following these steps and still seem to have a sore muscle that won’t heal, meaning its lasted more than four days without getting better, make an appointment with your doctor to see how you can work toward your goals without hurting yourself.