Does your mind wander? During a class or meeting, do you find yourself staring out the window and thinking about what you’ll do tomorrow or next week? As a child, were you constantly reminded by teachers to stop daydreaming?

Well, psychological research is beginning to reveal that daydreaming is a strong indicator of an active and well-equipped brain. Tell that to your third-grade teacher.

A new study, published in Psychological Science by researchers from the University of Wisconsin and the Max Planck Institute for Human Cognitive and Brain Science, suggests that a wandering mind correlates with higher degrees of what is referred to as working memory. Cognitive scientists define this type of memory as the brain’s ability to retain and recall information in the face of distractions.

For example, imagine that, when leaving a friend ‘s house, you promise to call when you get home safely. On the way, you stop to buy gas and a few groceries, and then drive by a car accident and get out to see if anyone needs help. Finally, when you get to your house, you remember to call your friend. The ability to do this depends on the brain’s working memory system.

In the study, the researchers sought to examine the relationship between people’s working memory capacity and their tendency to daydream. To accomplish this, they first asked participants to do one of two extremely easy tasks that might prompt them to daydream—either press a button in response to a letter appearing on a screen or tap their finger in time with their own breath—and periodically checked in to see if the subjects were paying attention or not. Then they measured each participant’s working memory by testing their ability to remember a series of letters interspersed with a set of easy math questions.

Surprisingly, there was a correlation between mind wandering during the first task and high scores on the working memory test. The participants who more frequently daydreamed were actually better at remembering the series of letters when distracted by the math problems compared to those whose minds were less prone to wandering.

Why might this be the case? “What this study seems to suggest is that, when circumstances for the task aren’t very difficult, people who have additional working memory resources deploy them to think about things other than what they’re doing,” said Jonathan Smallwood in a press release. In other words, daydreamers’ minds wander because they have too much extra capacity to merely concentrate on the task at hand.

These results, the researchers believe, point to the fact that the mental processes underlying daydreaming may be quite similar to those of the brain’s working memory system. Previously, working memory had been correlated with measures of intelligence, such as IQ score. But this study shows how working memory is also closely tied to our tendency to think beyond our immediate surroundings at any given time. “Our results suggest that the sorts of planning that people do quite often in daily life—when they’re on the bus, when they’re cycling to work, when they’re in the shower—are probably supported by working memory,” Smallwood said. “Their brains are trying to allocate resources to the most pressing problems.”

The researchers stress that those with higher working memory capacities—and thus those who are naturally most prone to daydreaming—still have the ability to train themselves to focus their attention on what’s in front of them, when necessary. “Mind wandering isn’t free—it takes resources,” Smallwood said. “But you get to decide how you want to use your resources. If your priority is to keep attention on task, you can use working memory to do that, too.”