Remember picking up a guitar and wanting to be the next Kurt Cobain or Jimmy Page? Even if you never became a rock star, you should stick with it, a new study suggests. Making music may keep your mind sharp as you age.

Researchers at the University of Kansas Medical Center offered a cognitive exam—a test of memory, attention, and language functions, among other things—to 70 adults aged 60 to 83. They were divided into three groups based on lifetime musical experience: those who’d had no training; those who’d played an instrument for between 1 and 9 years; and those who’d played for more than a decade.

The longest-playing musicians performed best, followed by the shorter-term players, and—finally—the non-musicians.

All of the musicians had learned to play by age 10, a crucial aspect of the study. “Age of acquisition is really important,” says Brenda Hanna-Pladdy, Ph.D., assistant professor at the University of Kansas Medical Center and the study’s co-author.

As many of us are painfully aware, it’s easier to learn when you’re young: Research suggests that the intensive repetitive practice needed to learn an instrument can actually reorganize younger brains. That process can also help you build a mental bank to draw on later in life. “It’s not a dementia cure,” Hanna-Pladdy says, “but people with this cognitive reserve can function longer and more effectively.”

But why music? The question isn’t completely settled, but researchers speculate that because it engages so many areas of the brain, music training can have broad benefits. Of course, that doesn’t mean that playing an instrument is the only way to stay mentally fit. “The point is to be cognitively active, and this may be one of the most robust ways to do so,” says Hanna-Pladdy.