Building underwater castles is a lot like gluing together bones, it turns out. The sandcastle worm must cement bits of shell and grains of sand in place, just like bricks and mortar, by secreting an adhesive that will not dissolve in the surrounding seawater. That means the substance has to start as a malleable fluid, then harden to a solid, all while immersed. The worm manages just that, by using varying pH levels to its advantage: when the adhesive is inside the worm where the pH is low, the glue remains fluid. Seawater, with its higher pH, causes the glue to slowly harden, forming the rigid walls of the worm's undersea sandcastle.