It was probably only a matter of time before some researcher down the line wondered why we swear when we’re upset and whether it holds some biological function. Richard Stevens, a researcher from Keele University, is that guy.

Stephens became curious about the underlying reasons and function of swearing when his wife yelled out strings of expletives during childbirth: Did swearing somehow ease her pain or help her endure suffering? “I thought there was a good chance that swearing would help people cope with pain, because there has to be a reason people do it,” Stephens told The Daily Beast. Initially, the researchers thought that obscenities were a form of “catastrophizing,” which is a type of cognitive distortion that maximizes the painful event in the person’s mind. But it turns out that swearing can sometimes make you feel better — it both conveys emotions and behaves as a coping mechanism.

Stephens’ study showed that, not surprisingly, swearing was closely linked to an “emotionally aroused state” and intense feelings. “As we looked into swearing further, it became apparent that it’s actually emotional language, and can make you feel better in certain situations,” Stephens told The Daily Beast. “If you’re waiting for an ambulance and have no drugs, cursing can actually reduce the feeling of pain.”

In the study, participants were asked to play video games — either a golf game or a violent game. Those who played the violent game showed higher levels of aggression and could easily reel off curses in comparison to those who played the golf game, linking emotional response to swearing. Meanwhile, in a 2009 study, also led by Stephens, researchers found that cursing during high-stress situations can actually increase pain tolerance. They tested 64 participants who were asked to place their hands in a tub of ice water for as long as they could. They were told to repeat a swear word of their choice, and afterward, they repeated the experiment, but this time used a common word that describes a table. The results showed that volunteers were able to keep their hands submerged in painfully freezing water for longer if they swore.

Swearing triggered higher aggression and a “fight-or-flight” response, including an accelerated heart rate and higher adrenaline. Thus, swearing and this “fight-or-flight” response “downplay[ed] feebleness in favor of a more pain-tolerant machismo.”

But why does the word “f*ck” trigger this physical and emotional response, but “tablecloth” doesn’t? It might have to do with the fact that swear words are considered taboo — they are inherently linked to emotion and are something like the horn on your car — urgent, astonishing, and commanding attention. So next time you stub your toe, don’t feel bad for yelling, “Goddamnit!” Of course, unless there’s a young child around. Then again, Stephens actually traces his interest in swearing back to his childhood, when he'd become curious about adults using these taboo words. “I’ve been curious about swearing since childhood,” he explains, “because there’s a sort of fascination around hearing adults curse and use a language that you can’t. That interest stays with people.”