In December 2016, the company I was working at cut my hours from full-time to part-time. Two months later, they laid me off.

In January, I was still optimistic that my reduced hours would bounce back to full time, so I made a goal — a small goal — to hike five times that month. Fulfilling that goal helped me handle the disappointment of being laid off, gave me something to do with my spare time, and quieted the unkind thoughts in my head.

Here’s how winter hiking helped me stay sane.

It got me out of the house and out of my head

This was my first ever job out of college. As a startup, it had no benefits. Plus, my spouse was still getting his undergrad. Finances were tight, we barely had health insurance, and getting my hours cut was a real blow.

I went to work in the morning and finished around noon. Since I had so much extra time, I would go back home and do…nothing. I got stuck in my own head and thought about how worthless of an employee I must be to get my hours cut.

I couldn’t live like that, so I left the house and started hiking instead. I layered up, laced up my trail running shoes, and went to hike in the snow on the nearby mountain in Utah Valley. Just taking action made a difference.

An article in Business Insider discussed research from Iowa State University that found the simple act of walking can improve your mood. It seems the act of moving itself, regardless of where you are or what you’re doing, can help your body experience more positive feelings. Hiking is basically walking, but a little more intense.

The challenge was terrifying and exhilarating

Winter hiking came with its own challenges: staying warm, hiking before sundown, telling people where I was in case something happened, and the extra effort that came with hiking in snow.

Studies have been done to focus on the mindful nature of walking. Winter hiking can help you do that due to its challenging nature. You’re focusing entirely on hiking safely, the way your body is feeling while hiking, the temperature outside, and where you’re going. Here was a hobby outside of my professional life that I could do and allowed me to think in the moment.

I did the same trail every time. It was a steep hill that had an elevation gain of 1,102 feet over the course of 1.2 miles one-way. I got a good cardio workout from the steepness alone.

One time I hiked in the late afternoon around 5 p.m. Except for the backcountry snowboarder I met on the way up, I was alone.

Sweating uphill had warmed me up plenty, but going downhill was cooling me down. The sun was setting and the night was cooling down quickly. I had a short window of time to get to my car and had forgotten gloves. I started trotting faster down the mountain, as fast as my feet would let me without slipping on the snow.

I made it to the car after sunset. My car took 20 tries before it started (because of course it did, we couldn’t afford to fix our car) and my hands were numb, but I made it. My challenge was terrifying, but for once, I was focusing more on not dying than what was going on at work.

It’s peaceful as all get out

Have you ever heard of forest bathing? It’s the act of immersing yourself in nature and engaging all five senses. An article on CBS News discussed how spending time in nature can reduce depression and anger, as well as improve cardiovascular health, cognitive function, and creativity.

While my hiking wasn’t exactly in the forest — it was more on the face of a prominent mountain — I experienced the benefits nonetheless.

Winter hiking brings total stillness.

It’s not as common, so there are less people. Snow also has a peaceful element about it. The trail I hiked was popular enough that I saw at least one other person on it, which helped me feel safer. I experienced the benefits of enjoying true alone time and total peace.

The challenge of my hike, the peace I experienced, and just getting out of my house helped me feel better. It didn’t completely erase the pain of losing my job, but it helped. It gave and still gives me something to look forward to and helps me find meaning outside of my job.