Being in a bad mood at work might not be such a bad thing. New research shows that foul moods can lead to better executive function—the mental processing that handles skills like focus, self-control, creative thinking, mental flexibility, and working memory. But the benefit might hinge on how you go through emotions.

As part of the study, published in Personality and Individual Differences, a pair of psychologists at the University of Waterloo in Canada subjected more than 90 undergraduate students to a battery of tests designed to measure their working memory and inhibition control, two areas of executive function. They also gave the students several questionnaires designed to measure their emotional reactivity and mood over the previous week.

They found that some people who were in slightly bad moods performed significantly better on the working memory and inhibition tasks, but the benefit depended on how the person experienced emotion. Specifically, being in a bit of a bad mood seemed to boost the performance of participants with high emotional reactivity, meaning that they’re sensitive, have intense reactions to situations, and hold on to their feelings for a long time. People with low emotional reactivity performed worse on the tasks when in a bad mood, though.

“Our results show that there are some people for whom a bad mood may actually hone the kind of thinking skills that are important for everyday life,” one of the study’s co-authors, psychology professor Tara McAuley, said in a press statement. Why people with bigger emotional responses experience this boost but people with less-intense emotions don’t is an open question. One hypothesis is that people who have high emotional reactivity are already used to experiencing intense emotions, so they aren’t as fazed by their bad moods. However, more research is necessary to tease out those factors.

[h/t Big Think]