When your teacher told you to stop daydreaming and pay attention, she might actually have helped improve your mood as well as your school performance — if the findings of a new study on mind wandering are anything to go by.
The research, published in Science, shows that a wandering mind — whether you’re fantasizing about your sunny honeymoon or ruminating on a brutal divorce — is linked to low mood.

“Unlike other animals, human beings spend a lot of time thinking about what is not going on around them, contemplating events that happened in the past, might happen in the future, or will never happen at all,” the authors of the study, Harvard doctoral student Matthew Killingsworth and psychology professor Daniel Gilbert, write in the new paper. And that unique ability, they found, does not make for a happier species.

To study the relationship between mind wandering and happiness, Killingsworth and Gilbert created an iPhone app — available at Trackyourhappiness.org — which contacted participants at random times during the day to ask about their mental state and their mood. About 5,000 people responded, ranging in age from 18 to 88 and living in 83 countries around the world; Killingsworth and Daniel analyzed responses from 2,250 for the study. (More on Time.com: Why We Conform to the Group: It Gets Your Brain High)

The app asked people three questions, related to happiness (“How are you feeling right now?”), activity (“What are you doing right now?”) and mind wandering (“Are you currently thinking about something other than what you’re currently doing?”). The results showed that people’s minds wandered a lot, regardless of what they were doing: people reported letting their minds wander 46.9% of the time, and at least 30% of the time during every activity except having sex. What’s more, people reported feeling less happy when their minds wandered than when they didn’t — even when the tasks at hand weren’t enjoyable.

“Our main result is that mind wandering on average is associated with less happiness,” says Killingsworth. “Unpleasant mind wandering in particular makes the single biggest difference in happiness [levels]. However even you if took out [negative trains of thought], mind wandering was still associated with less happiness.” (More on TIME.com:Doodling May Help You Pay Attention)

The direction in which the mind ran off was also found to be unrelated to the person’s current situation and didn’t lift his or her mood, even when thinking about pleasant things. In other words, when people were doing fun things, their minds didn’t necessarily go to pleasant places, nor did people seem to be able to escape unpleasant tasks by drifting into a better mental spot. “When people are engaged in doing unenjoyable tasks, even when they’re thinking about pleasant things, it’s not having a positive impact. That’s surprising to me,” says Killingsworth.

On the other hand, the study did find that negative mind wandering was associated with even more unhappiness. And, in general, the researchers found that what a person was thinking about was a better predictor of happiness than whatever he or she was doing in that moment. (More on Time.com:Spend Too Much For Those Shoes? Blame Your Genes)

Although previous research has shown that feeling down can lead to mind wandering, this study found that the reverse was true as well: mind wandering often predicted bad moods, rather than following them. “I think there’s lots of evidence that rumination and worrying can cause a lot of stress in and of themselves,” notes Alan Marlatt, co-author of Mindfulness-Based Relapse Prevention, who was not associated with the study. Marlatt has spent decades studying meditation and other techniques to help focus the mind to fight addictions.

Indeed, in contrast to mind wandering, being able to focus on the present is thought to boost happiness. Most meditation techniques involve learning to “be in the moment,” and numerous studies have linked meditation to greater happiness, better ability to cope with stress and pain and even improvements in physical health. “It gives you more opportunity to stand back and take a moment to choose what to do next, instead of having your mind on auto-pilot and you’re not there,” says Marlatt. The ability to call home the wandering mind, and just “take time to be where you are,” through techniques like focusing on breathing can “make a huge difference,” he says. (More on TIME.com:Losing Focus? Studies Say Meditation May Help)

But that’s not to say that mind wandering is all bad: innovative ideas and insights often arise through free association. And being able to plan and strategize effectively require a focus on the future, not the now. “There’s no doubt that this capacity is beneficial in a variety of ways and it’s certainly very possible that a lot of creative thinking involves mind wandering,” says Killingsworth.

“In this electronic age where everyone’s on the phone all the time and [constantly distracted], it’s interesting to use an app to maybe turn that around and ask people to be more mindful instead of just answering the next email,” says Marlatt.