Since 1876, when Henry Heinz first started selling ketchup in glass bottles, people have been arguing over the best way to get the condiment out of the packaging and onto their plates. While tricks like tapping the “57” emblazoned on the side of the bottle may help, a physicist decided to apply a little science to the matter and now has found what he calls a scientifically optimized method for getting the ketchup to flow.

While it may look like a liquid, ketchup is actually a non-Newtonian fluid—the same category of substances as that favorite middle school science project, oobleck. As NPR’s Linda Poon explains, instead of flowing consistently the viscosity of these substances change with the amount of force put on them. But once that threshold is passed (say, when the bottle is shaken just hard enough) the ketchup becomes 1,000 times thinner. That’s why your fries often end up buried under a mountain of the red stuff once it finally relinquishes its hold on the glass.

“If you tilt a bottle of water, the water flows out because it is a liquid. But tomato sauce prefers to be in the bottle because it is technically a solid, not a liquid,” University of Melbourne physicist Anthony Stickland says in a statement.

Because of the physics that govern ketchup’s viscosity, packaging them in glass bottles makes it much harder to hit that pressure sweet spot. But if you’re dedicated on sticking to the classics and not switching to squeeze bottles, Stickland has developed a three-step method based on physics for coaxing ketchup out of the bottle, Daisy Meager reports for Munchies.

“Always start by giving the sauce a good shake,” Stickland says in a statement. “You need to overcome the yield stress to mix it, so it needs a decent oomph—briefly invoke your inner paint shaker. Remember to keep the lid on, of course.”

The next step is to flip the bottle upside-down (with the lid still on). Then, shake the bottle until the ketchup has slid into its neck. Lastly, turn the bottle so that it’s pointing towards your meal at a 45-degree angle and uncap. If needed, Stickland says to give the ketchup a little “encouragement” by tapping on the bottom of the bottle—gently at first, but with increasing force until it finally slides out and onto the plate.

“The trick is to get the sauce flowing, but not too fast,” Stickland says in a statement.

This scientifically-vetted maneuver should be just the thing to get even the most stubborn bits of ketchup out of the bottom of the glass bottle—though to be honest, the squeeze bottle might be easiest.