You know that getting your sweat on in the gym is good for your physique, and for better overall health. But new research from the University of Geneva suggests that exercise could also benefit your memory.

To find out how exercise — especially endurance sports like running or cycling — affects the brain, researchers had 15 young, male, non-athletes take a memory test under different conditions. They were given the test after 30 minutes of moderate cycling, 15 minutes of intensive cycling at 80 percent of their max heart rates, or after a period of rest. And as it turns out, upping the intensity may be best.

“The exercise was as follows: a screen showed four points placed next to each other. Each time one of the dots briefly changed into a star, the participant had to press the corresponding button as quickly as possible,” Blanca Marin Bosch, a researcher involved in the study, explained in a release. “It followed a predefined and repeated sequence in order to precisely evaluate how movements were learnt. This is very similar to what we do when, for example, we learn to type on a keyboard as quickly as possible. After an intensive sports session, the performance was much better.”