Even if you love your job, an occasional bad day is par for the course. Everyone has those days where no matter how many happiness hacks or positive mantras you try, you just can’t shake a glass-half-empty attitude. A bad mood can ruin your productivity, putting the kibosh on your motivation and draining you of your creative energy.

The secret to recovering from a bad day is learning how to move forward despite it. How you respond can mean the difference between a quick recovery or devolving into a full-blown funk.

Here are five steps to help you get back on track so you can come back stronger tomorrow.

1. Don’t Ignore It

Don’t push away your emotions; embrace them. Give yourself permission to release any feelings of anger, guilt, or self-blame so that you can move on. Remember, you’re human, and like the rest of us, you’re bound to have moments when you’re not performing at your best. As much as your inner perfectionist may be railing against that idea and chastising you, be kind to yourself.

2. Change Your Mindset

In the middle of a bad day, you’re prone to making catastrophic statements like, “I feel so stupid” or “Nothing is going according to plan.” Unhelpful thinking is common, but you can unhook from it with reframing.

For example, “I keep messing up at work, and I’m so frustrated with myself” becomes “I’m having the thought that I’m not accomplishing enough, and I’m feeling frustration because of it.” Labeling your thoughts and emotions in this way has been shown to improve problem-solving and lower stress.

Once you identify your automatic negative thoughts, tweak your self-talk to be more balanced and realistic.

3. Connect to Recalibrate

When you’re having a bad day, it’s tempting to retreat and wallow alone. But resist the urge to isolate. We all have that one buddy who puts a smile on our face, no matter what, so see if you can arrange a quick coffee date with this person–or, if he or she lives far away, send an email or text.

4. Treat Yourself — the Healthy Way

Don’t confuse self-care with self-sabotage. Skip drinking the day away at happy hour. Focus on activities that restore you and help you feel refreshed, even in the tiniest way. That may be giving a co-worker a compliment, going to bed an hour earlier, or saying “no” to a networking event so you don’t overextend yourself.

5. Put it Behind You

Draw a boundary with an evening routine that brings closure to a bad workday. At home, request space to decompress if you need it.

Instead of beating yourself up when a crummy day happens, expect them. Remember, you get to decide how you respond when bad days happen. Will you let it derail you? Or will you choose to see failure as feedback, a tiny bump in the road on the way to achieving your goals?