It’s happens to the best of us.

You’re sitting in a meeting, and your mind wanders—tasks on your to-do list, what your coworker said last week, or that harebrained idea you’ve been waiting to pitch your CEO now for weeks.

Then suddenly, you hear your name.

Disheveled and confused, you’re forced to reckon with your failure to pay attention: “I’m sorry… what was the question?”

The next time your boss shoots a disapproving look your way, just pass along this new academic paper from Rice University Associate Professor of Management Erik Dane, Ph.D.

Published in the Academy of Management Review in April, Dane argues that mind wandering can actually be beneficial for business goals—depending on the type, content, and job role of the wanderer. While mind wandering can distract from tasks at hand, it can also assist with long-term projects by focusing us on goals, assisting with planning for the future, and thinking of creative solutions to business problems.

The catch is, it all depends on your job and where exactly your mind wanders.

A Wanderful World

Our brains spend a lot of time wandering—as much as half our waking hours, according to some studies.

In his paper, Dane defines mind wandering as “a psychological state in which one’s thoughts have departed from the task at hand as well as the stimulus environment more generally.” In contrast to distraction, a wandering mind is surprisingly resilient to environmental distractions, and can even happen in distraction-free environments (can’t blame this one on open-floor offices, sorry folks). In fact, research suggests that a wandering mind is actually our brain’s default state—where it goes when we have nothing else to focus on. A restful mind is not one without any thoughts, but one filled with them.

Dane lays out three types of content our minds tend to wander to:

Current concerns: This type of mind wandering focuses on “one’s current circumstances in life and/or work.” This could include upcoming projects or macro concerns like market conditions that might affect your job role.

Mental time travel: This type involves thinking about the past or future. This includes considering how future events might play out based on past experience.

Imagination: My personal favorite, this type of mind wandering involves thinking up “possibilities or scenarios disconnected from concerns for plausibility or feasibility.”

With each of these three, he defines two ways our brains approach each: problem-focused, and emotion-focused.

Problem-focused thinking is more action-oriented and productive (in the work setting), and for the purposes of Dane’s paper the kind that is most helpful at work.

Emotion-focused thinking, on the other hand, “involves dwelling on the past, worrying unnecessarily,” and thinking in harmful ways that can decrease happiness and not provide any progress. Dane is quick to point out that he’s not disparaging being an emotional being, but categorizing a type of mind wandering that is typically “characterized by counterproductive (or even destructive) emotions.”

Dane offers up 10 ways in which mind wandering can be helpful or harmful for task performance over time.

Problem-focused thinking is generally more helpful at work.

Problem-Focused Mind Wandering is HELPFUL

Current concern mind wandering helps us remember deadlines and goals when it is work-related and goal-directed

Often times, our mind wanders to looming deadlines. When this type of thinking is problem-focused, it serves to keep our goals top-of-mind and keep us focused.

Current concern mind wandering is more helpful for jobs that involve a large number of goals.

While a job with many goals may be more complex (and therefore, more at risk to be harmed by a wandering mind), current concern mind wandering can serve to keep all those goals organized in your mind. A job with few goals can be prone to distraction by frequent mind wandering.

Mental time travel mind wandering is helpful when it involves work-related anticipatory thoughts

Dane suggests that problem-focused mind wandering is a helpful tool for planning and preparation by allowing us to work through future problems that may arise. That being said, not every job role requires this type of forward-thinking…

Anticipatory mind wandering is more helpful in jobs where future events are reasonably predictable.

It’s easier to foresee future events in some job roles than others. Dane points out that for some jobs, planning and preparation are “largely useless enterprises because few if any valid cues exist for accurately anticipating what the future holds.”

Imaginative mind wandering is helpful when it involves “work-related playful possibilities.”

We’re all prone to imaginative thoughts every now and then, but you can harness that power for productivity by directing your mind to work-related problems. Dane concedes that non-work-related problem solving can indeed provide assistance in our 9-to-5s, but in general, if we’re trying to use mind wandering to help at work, we should probably keep it to job-related playful possibilities.

Of course, that depends on your job requiring creative thought…

Imaginative mind wandering is helpful when your job requires “generative objectives.”

Some jobs don’t ask that you think of new solutions to problems. Even within jobs that require a high-level of creative problem solving, certain tasks require free thinking while others call for concentration. Try to be aware of which tasks on your schedule require each kind of thinking.

Emotion-focused mind wandering can lead to rumination and emotional exhaustion.

Emotion-Focused Mind Wandering is HARMFUL

Current concern mind wandering hurts us when it leads to inefficient allocation of brain resources and avoidance behavior.

Much like me scheduling a doctor’s appointment, emotion-focused mind wandering on current concerns can lead to fruitless worrying and avoidance behavior. Rather than being a helpful pursuit, this type of wandering can often paralyze you from taking action and choosing to avoid unpleasant tasks instead.

Mental time travel mind wandering is harmful when it focuses on ruminating on the past, leading to inefficient allocation of brain resources and depressive moods.

If your mental time travels tend to focus less on preparing for the future and more on dwelling about past wrongs, it could be more than just hurting your job performance—you could be putting yourself on the fast track to depression.

Dane points out that this emotion-focused rumination has been closely tied to the onset of depression in psychological studies. This type of thinking “tends to perpetuate itself such that it hinders people from progressing toward problem-focused thinking.”

Imaginative mind wandering is harmful when it focuses on “vengeful schemes.”

Emotion-focused mind wandering in the imaginative sense can often lead us to plotting revenge against those who have wronged us. This may sound overly dramatic, but just about anybody can think of a time they were wronged and has probably played out a scenario when they finally get even over and over in their minds.

Similar to rumination, this type of thinking can “perpetuate negative feelings” and “render one vulnerable to emotional exhaustion.” Obviously, this is detrimental to job performance, but more importantly, it’s lethal to your emotional wellbeing.

Mind wandering is harmful if your job requires a high level of monitoring.

Let’s face it, you probably don’t want an air traffic controller to have a mind prone to wander.

Certain jobs require lots of monitoring—watching a variety of inputs to notice when intervention and direction is needed. If your job requires focused attention for long periods, mind wandering will lead to serious problems.

Mind Wandering vs. Mindfulness

This approach to daydreaming and mind wandering would seem to be in direct contrast to another psychological approach that has been gaining popularity in the business world of late—mindfulness.

Mindfulness teaches the value of being fully present in your current situation and task, not letting distractions or a busy brain take you away from the people you’re with or the work you’re doing. While this may seem to be in direct contrast to preaching the benefits of a wandering mind, Dane says that realistically, the two must work together.

“In almost any job there are times when focusing on present moment events is imperative, and yet a workday bereft of mind wandering may be severely impoverished in certain psychological processes instrumental to task performance over time (e.g., planning and preparation). It is therefore reasonable to expect that both mindfulness and mind wandering have key roles to play in many work settings.”

So next time you find yourself staring out the window and thinking about an upcoming project, try not to be too hard on yourself. It might just be helping you in the long-run.