For ant larvae and pupae, getting sick is a death sentence. When adult ants spot an infirm individual in their spotlessly clean nest, they simply chuck it out and leave it to die. This extreme “hygienic behavior,” as it’s technically called, is an effective way of containing disease outbreaks in crowded insect colonies. But some pupae have worked out a way to avoid nest eviction—by growing inside bug-proof cocoons and dodging disease, reports a study published this week in BMC Evolutionary Biology. Scientists have long wondered why in some ant species the pupae spin silk cocoons around their bodies, whereas in others the pupae are “naked.” In a few odd cases, ants can even swing both ways: In the same species, some pupae build cocoons, but others live happily without one. Or maybe not. When researchers infected different ant species (with cocooned, naked, or indecisive pupae) with a deadly fungus, the adults swiftly removed the diseased brood from the nest. However, cocooned pupae were often left behind, and even though they remained exposed to the fungus, they didn’t get sick. The authors conclude that cocoons act as shields against fungal invasion. It’s a win-win situation for the ants: The pupae don’t get sacrificed and the colony stays safe from an epidemic.