Volunteering is good for your mental health, especially in middle age and beyond, according to a new study.

The report, published in the journal BMJ Open, surveyed people living in 5,000 households in Great Britain over several years. About 20% of the people surveyed said they volunteered.

On a questionnaire that measured mental health and wellbeing—where lower scores were considered healthier—people who volunteered scored about 10.7, compared to the average score of 11.4 among people who didn’t volunteer. Volunteering may “provide a sense of purpose,” the researchers write in the study, while helping maintain social networks that are critical as people age.

You can read the report in full here.