Letting your mind wander may actually help your concentration, suggests new research from Cornell University.

Here’s why scientists think that: In a study, participants matched photos of celebrities more quickly and accurately than they did for pictures of anonymous people they didn’t recognize.

The celebrity pictures sparked the activation of long-term memories in the study participants. This boosted the participants’ short-term memory performance, which was also associated with greater activity in the brain region that’s involved in things like imagining or reminiscing.

In other words, thinking about certain moments from the past can help you crack present problems. “We’re able to use information from our long-term memory to solve the task at hand and succeed at it even better,” says study author Nathan Spreng, Ph.D.

Previously, neuroscience experts believed that all daydreaming squashed your focus and hindered your performance. And that’s still true if your mind wanders way off course—like if you start musing about what you did last weekend when you’re proofing your sales figures for errors.

But if you summon up a long-term memory that’s relevant to what you’re working on, you can actually help your performance, says Spreng. Going over your sales stats? Let your mind wander to that mistake you caught on last quarter’s report.