Here’s more reason to keep running well after you’ve eclipsed 40 years old: Endurance exercise may keep your brain working at full-tilt as you age, according to a new study in the journal Medicine & Science in Sports & Exercise.

Researchers at the University of Texas at Austin attempted to determine the correlation between a person’s cardio fitness and cognitive function in middle-aged adults.

The study drew from a sample of 59 adults between the ages of 43 and 65, with 32 participants classified as endurance-trained subjects and 27 as sedentary subjects. The exercising group had engaged in moderate or strenuous aerobic exercise for at least four days or seven hours a week, while the sedentary subjects exercised less than one hour a week.

The measurements used in the study consisted of an incremental treadmill test to measure cardio fitness, an ultrasound to measure blood flow velocity, and a series of cognitive tests that gauged a subject’s memory and attention.

Overall, the exercise group displayed a better performance on memory-related tests and had better cognitive composite scores. The possible link between exercise and staying sharp? People who exercised also displayed better vascular function, or blood flow in the brain, than the sedentary individuals.

“The findings from this study suggest that middle-age runners do not only have better cardiovascular function and health, but also enhanced cognitive performance particularly in the domains linked with age related cognitive decline and impairment,” said Dr. Martha Pyron, a coauthor of the study.

The study concluded, “Habitual aerobic exercise ameliorates vascular health, an effect which may further translate into improved cognitive performance.”

Although the majority of the endurance trained participants in the study were runners, Pyron said results imply that other forms of aerobic exercise, such as swimming or biking, can also have a positive impact on vascular health, and, in turn, cognitive function.