You know what sucks: When you’re really excited to drink a large-format bottle of beer you’ve been saving, you open it, and it overflows with foam.

Thankfully, Belgian food scientists have discovered how to counteract the explosive, frothy nature of beer.

To understand beer froth, you need to first take a look at hydrophobin—the main culprit of beer gushing—which is a protein created by a fungus “that infects malt grains during the brewing process, attracting carbon-dioxide molecules within the beverage to the surface,” according to The Atlantic.

An abundance of carbon dioxide molecules at the beer’s neck causes the bottle to bubble over when the beer is opened. This foam overflow—called “gushing”—is different than the frothy foam head that appears when you pour a beer from a tap.

Now back to the solution to beer gushing.

To stop gushing from happening, brewers will traditionally add extra hops into the mix when brewing (the hops act as an antifoaming agent). But this technique is not perfect, and gushing can still occur.

After realizing that “magnetic fields can disperse particles and help emulsify mayonnaise,” Belgian scientists decided to magnetize beer to thwart gushing. And it worked.

The scientists brewed a batch of beer at Orval Brewery in Belgium, and after they added in the hops, they passed the brew through a glass tube that had a magnet wrapped around it. The Atlantic reports,

“What they found was that when the brew passed through the magnetic field, the hops broke apart and spread throughout the beverage, effectively increasing their surface area. With more surface area, the tiny antifoaming particles bound with more hydrophobins than whole hops could, the team reported in a paper set to appear in the January edition of the Journal of Food Engineering.”

The magnetization worked as a way to prevent gushing, which in turn allowed the scientists to experiment with adding less hops. Long live beer-gushing!

[via The Atlantic]