In the game of life, some may assume that it’s all downhill once you reach middle age. But a new study says otherwise, finding that the mental health of aging adults seems to consistently improve over time.

Researchers at the University of California, San Diego School of Medicine, examined answers to questions about physical health, cognitive function, and mental well-being from 1,546 adults, aged between 21 and 100, living in San Diego County, who were selected using random digit dialing.

What they found surprised them. The oldest participants enjoyed significantly higher mental health scores when compared with younger participants ― despite the fact that older people suffered from much worse physical and cognitive function.

“Their improved sense of psychological well-being was linear and substantial,” said senior author Dilip Jeste, in a written statement released by the university. “Participants reported that they felt better about themselves and their lives year upon year, decade after decade.”

When it came to adults in their 20s and 30s, Jeste and his colleagues uncovered high stress levels as well as signs of depression and anxiety, part of a troubling trend of rising psychological distress and mental illness rates among younger people. Mental health improvements were noted when people hit their 40s, with levels of happiness growing consistently as people grew older.

“This ‘fountain of youth’ period is associated with far worse levels of psychological well-being than any other period of adulthood,” Jeste said.

Researchers also were surprised that they did not discover any kind of midlife dip in well-being ― contrary to what some other studies have found. Instead, participants reported feeling better and better about themselves and their lives year upon year, decade after decade.

It’s not 100 percent clear why older people express more satisfaction with their life, Jeste said, although it’s possible that people become better at coping with stress as they age. Another reason, he added, could be that older people retain fewer negative memories and are more adept at handling with their emotions.

They learn “not to sweat out the little things,” Jeste said.

The findings are published in the August 2016 issue of the Journal of Clinical Psychiatry.

Other recent studies, too, have found that people get happier as they age. For example, in February, the British government released a survey of more than 300,000 adults over the span of three years in an attempt to pinpoint which time of life people are their happiest. The survey found that satisfaction with life peaks for many after age 65 and can be expected to last through one’s 70s.

Maybe the best really is yet to come.