If you were like most young guys in college, you had a couple of nights at a friend’s keg party or down at the local bar where you ended up waking up in the morning with little to no idea of how you made it into bed. Or why you were missing a tooth. Or where your pants were.

So yeah: Blacking out and losing memory is a regular occurrence when people drink to excess. But drinking while doing a memory exercise actually led to better recollection in a recent study from the University of Exeter in England.

For the study, scientists gathered 88 men and women accustomed to drinking alcohol—so, yes, a relatively tiny study—and put them into two groups that were both assigned to a word-learning task. One group could drink as much as they wanted, while the other was told not to drink anything. The following day, both groups met up and all did the same word-learning test—but those who imbibed the night before remembered more of what they had absorbed previously.

“Our research not only showed that those who drank alcohol did better when repeating the word-learning task, but that this effect was stronger among those who drank more,” said Celia Morgan, Ph.D., professor of psychopharmacology at the University of Exeter. “The causes of this effect are not fully understood, but the leading explanation is that alcohol blocks the learning of new information and therefore the brain has more resources available to lay down other recently learned information into long-term memory. The theory is that the hippocampus—the brain area really important in memory—switches to ‘consolidating’ memories, transferring from short into longer-term memory.”

Though how much alcohol you should drink to get any health benefits has been debated in the last few years, it’s generally thought to be safe—and possibly beneficial—if you keep your consumption at about two drinks per day, saccording to the U.S. Centers for Disease Control. Drinking to excess, though, has been found to contribute to all sorts of nastiness, like increased risk of cancer, heart murmurs, poor sleep, and loss of muscle mass—so keep your beer binges to a minimum. Plus, swearing off booze altogether is a good way to prevent extra calories from sneaking into your diet.