People who watch funny videos on the internet at work aren’t necessarily wasting time. They may be taking advantage of the latest psychological science—putting themselves in a good mood so they can think more creatively.

“Generally, positive mood has been found to enhance creative problem solving and flexible yet careful thinking,” says Ruby Nadler, a graduate student at the University of Western Ontario. She and colleagues Rahel Rabi and John Paul Minda carried out a new study published in Psychological Science, a journal of the Association for Psychological Science. For this study, Nadler and her colleagues looked at a particular kind of learning that is improved by creative thinking.

Students who took part in the study were put into different moods and then given a category learning task to do (they learned to classify sets of pictures with visually complex patterns). The researchers manipulated mood with help from music clips and video clips; first, they tried several out to find out what made people happiest and saddest. The happiest music was a peppy Mozart piece, and the happiest video was of a laughing baby. The researchers then used these in the experiment, along with sad music and video (a piece of music from Schindler’s List and a news report about an earthquake) and a piece of music and a video that didn’t affect mood. After listening to the music and watching the video, people had to try to learn to recognize a pattern.

Happy volunteers were better at learning a rule to classify the patterns than sad or neutral volunteers. “If you have a project where you want to think innovatively, or you have a problem to carefully consider, being in a positive mood can help you to do that,” Nadler says. And music is an easy way to get into a good mood. Everyone has a different type of music that works for them—don’t feel like you have to switch to Mozart, she says.

Nadler also thinks this may be a reason why people like to watch funny videos at work. “I think people are unconsciously trying to put themselves in a positive mood”—so that apparent time-wasting may actually be good news for employers.