Give Netflix a break if you want to beat the blues: Spending your time volunteering might make you happier, a recent study published in BMJ Open suggests.

People who reported volunteering at least once per week scored higher on a test that measured happiness and wellbeing levels than those who volunteered less often.

Related: 20 Secrets To a Happier Life

But the kicker? The link was only strong in people 40 or older.

That’s because younger people might think of volunteering as yet-another obligatory task they need to fulfill in order to be a good employee or parent—say, like serving on a committee at your kid’s school, says lead researcher Faiza Tabassum, Ph.D., of the University of Southampton in the U.K.

And when you’re at that stage in life, other activities like climbing upward on your career ladder or focusing on new romantic relationships may give you a bigger wellbeing boost.

Once you hit middle age, though, your career and relationship track may be more set, and volunteering becomes more appealing as an activity, not an obligation.

Related: The Video Workout Program Specifically Designed for Men Over 40

Now, this doesn’t mean that younger guys shouldn’t volunteer at all, or that they won’t gain something out of giving back.

In fact, research has shown that heart health tends to improve for those who take on volunteer work—and that seems to hold true no matter what the person’s age, says Tabassum.

That’s because most volunteer projects have a social element that helps you connect with others, which could end up protecting your heart.

Related: Why Lonely Guys Are 29% More Likely to Suffer a Heart Attack

The best way you can make sure you’re gaining the benefits from volunteering—and not just seeing it as another necessity you have to cross off the list—is to ensure you’re invested in the cause.

That means choosing something that you find personally meaningful—say, building a home for a low-income family if you’ve struggled with money yourself, or volunteering to deliver meals to the elderly if you’ve had a deep connection with your grandparents.

As a result, you may not feel that sense of obligation some younger people have toward volunteering, Tabassum says.

And make sure you’re not overscheduling yourself, either: That’ll just add to your stress and make you dread volunteer day.

Related: 8 Weird Signs You’re Way Too Stressed Out

Instead, Tabassum advises, fit it into your schedule where you can. Although once a week was most beneficial for those over 40, even just once a month or several times a year can provide a mental boost.