I often find myself nostalgic for days gone by—especially my young adulthood. Thinking about days when I could go backpacking with a friend on a moment’s notice or dance the night away at my wedding, without the constraints of child care or a limited energy supply, gives me a bittersweet feeling—a mixture of joy, sadness, and longing.

While I find nostalgia pleasant overall and even inspiring, doctors and psychologists did not always consider it a good thing. Staying “stuck in the past” was often associated with being unable to adjust to new realities, like when soldiers were nostalgic for their faraway homes and experienced loneliness and dread. Not that long ago, some considered nostalgia to be a mental illness, akin to melancholy, which could lead to anxiety, depression, and sleep disorders.

But more recent findings on nostalgia suggest it can be good for us, increasing our well-being, making us feel connected to other people, and giving us a sense of continuity in our lives. And it seems to come on naturally when we need to weather life’s difficulties. Rather than being a problem, nostalgia can help bring happiness and meaning to our lives.

Here are some of the ways nostalgia can benefit us, according to science.

Nostalgia makes us feel socially connected

Nostalgia about our past often includes recalling important people in our lives—people who cared about us and made us feel like we belonged. Certainly, my own nostalgic musings are centered around times when I was with the people and places I love. So, it’s not too surprising that recalling these special times would make us feel more connected to others, in general.

In one study, researchers found that people who were asked to write about an event from their past that made them feel “sentimental longing for the past” felt loved and supported, and this, in turn, helped buffer them against loneliness. Another study found that when people felt nostalgic about times in their lives when they interacted with members of an “out-group”—for example, teenagers recalling fun times with older adults—they felt less prejudice toward that group.

Nostalgia also seems to help us maintain our relationships. For example, one study found that inducing nostalgia helped people feel more optimistic about relationships in general and more willing to connect with friends. Another study found that when induced to feel nostalgia, people (especially those who find connecting with others easier) felt more able to offer emotional support to the people in their lives.

Nostalgia helps us find meaning in life

A sense of meaning in life involves knowing that your existence matters and that your life has coherence or purpose. It’s something we all strive for in one way or another.

Fortunately, research suggests nostalgia can be an important resource for increasing meaning, by highlighting central moments in our lives and giving us a sense of continuity.

In one study, researchers compared nostalgia to two seemingly related forms of thinking about one’s life: recalling a positive past event or imagining a desired future. Focusing on an event that made them nostalgic led people to feel their lives had more meaning compared to imagining a desirable future. And, compared to both other reflections, feeling nostalgic reduced people’s need to search for meaning in their lives—they already felt life had meaning.

In another study, people either listened to music that brought them back to a particular time or read lyrics to old songs. These nostalgic activities not only made them feel loved and socially connected but also increased their sense of meaning in life. And, when people read an essay that encouraged them to think that life had no meaning—which said, “There are approximately 7 billion people living on this planet. So take a moment to ponder the following question: In the grand scheme of things, how significant are you?”—they naturally turned to feelings of nostalgia for relief from that sense of meaninglessness.

These findings and others suggest that nostalgia not only heightens your sense of meaning in life, but can act as a buffer when you experience a loss of meaning. And it may help you move forward in life, too. As one study found, nostalgia can increase your motivation to pursue important life goals, because it increases meaning—not just because it puts you in a better mood.

Nostalgia can make us happier

Though it does seem to do just that—to boost our mood. Even though nostalgia is by definition a blend of positive and negative emotion, the positive tends to outweigh the negative, meaning we feel happier overall.

In one very recent study, 176 university students were randomly assigned to a six-week nostalgia program where they were asked weekly to write about a past event that brought on “a sentimental longing for the past” (while a control group wrote about past events that were ordinary). Afterward, they reported on their levels of positive and negative emotions and how much the writing provided a sense of social connection, meaning, or connection to their past self. At different points in time, they also reported on their life satisfaction, feelings of vitality, and well-being.