It’s happened to all of us. It’s a hot day, usually in the middle of the summer, and you want to cool off with some tasty ice cream or a Popsicle. You take a couple of bites and then it hits you! That sharp painful sensation that begins behind your eyes and quickly spreads to the rest of your head. It sucks. It really, really sucks. But at least the sensation usually leaves almost as quickly as it comes.

Of course, I’m talking about what most people know as “brain freeze.” Scientists identify it as a stimulus headache, or sphenopalatine ganglioneuralgia for all you science nerds. You may be surprised to learn that serious studies have been conducted on brain freeze at major institutions such as Harvard University.

These studies have shown that brain freeze happens when an extremely cold substance quickly hits the roof of the mouth, causing the capillaries to constrict, followed by an equally quick rewarming when warm air is reintroduced to the mouth. This warming causes vasodilation, or a widening of the blood vessels. The rapid changes in temperature in the upper mouth lead to this painful sensation.

Most of this is standard knowledge, but a study by Dr. Jorge Serrador revealed that there is a correlation between brain freeze and migraine sufferers. His research found that those suffering from migraines are more likely to get brain freeze, which suggests that there may be similar biological processes at work. Understanding how the contraction and widening of blood vessels in the brain take place may help scientists develop better headache medicines.

But what do we do about brain freeze right now?

Well, that’s easy enough. Slow down when you’re eating ice cream, or if you are unfortunate enough to get hit with a case of brain freeze, put your tongue on the top of your mouth. It works every time.