When the hot Cretaceous sun beat down on carnivorous dinosaurs like Tyrannosaurus rex, they had an innovative way to keep their heads cool: They released excess heat with the help of large cavities in their skulls, National Geographic reports. Paleontologists used to think the two or more openings on the top and side of their heads helped anchor the dinosaurs’ jaw muscles. But when researchers examined similar structures in alligator heads, they realized their theory had some holes. The openings in the alligator skulls were too far from the jaws, for one thing, and the bone surface appeared too smooth for muscles and tendons to attach. After monitoring the holey areas with thermal cameras, the researchers found that they were generally warmer or cooler than the rest of the skulls—leading them to suggest that the dinosaur holes may have played a similar role in temperature control, they reported last month in The Anatomical Record.