Thinking about your own death isn’t usually the most pleasant experience, but it can be a beneficial one. Reminders of our own mortality can increase our desire to make decisions that will leave long-term, positive impacts on generations to come, according to a new study published in Psychological Science.

Momentary social cues about death, such as reading about a death in the newspaper or walking past a funeral hall, activate the “legacy motive,” which contributes to the drive to gain a sense of purpose in life and to make an impact that will live on after death. The legacy motive enables us to look past inherent barriers to the use of resources in ways that will leave resources for the future, rather than immediate consumption by individuals in the present.