Of all the creatures living on Earth, it's the earthworms that probably have the worst diet. These squiggly landlubbers feed on toxins - dead leaves, rotten roots and dirt - but scientists from the Imperial College London have finally figured how their digestive systems manage despite eating "bad food."

The secret is in a molecule called drilodefensins, which the researchers said counteracts with the toxins from their diet. This molecule is apparently unique to earthworms.

"Without drilodefensins, fallen leaves would remain on the surface of the ground for a very long time, building up to a thick layer. Our countryside would be unrecognizable, and the whole system of carbon cycling would be disrupted," said Jake Bundy, the lead scientist of the study, according to a press release

Polyphenols present in plants, which gives its color and serves as an antioxidant, are supposed to block digestion in creatures that feed on them. But in the earthworms' guts, the drilodefensins serve as a defense. The more the earthworms digest polyphenols, the more their intestines produce drilodefensins.

Researchers were able to identify the molecule using modern visualization techniques based on mass spectrometry or MALDI imaging, according to Discovery.

"Using these molecular microscopes is changing how we understand complex biochemistry of living beings; we are now able to locate every molecule in, for example, an earthworm to a specific location. Knowing the location of a molecule can help us to figure out what it actually does," said another study author, Manuel Liebeke, in the press statement.

Despite their diet, the world benefits from earthworms thriving. Dubbed "nature's ploughs" by Charles Darwin, these creatures are the "key 'ecosystem engineers' within the carbon cycle," added Dave Spurgeon, another researcher.

The full study was published in the journal Nature Communications.