When it’s time to express gratitude for the many privileges bestowed upon your family this Thanksgiving, don’t forget to be grateful for mammoth poop. The excrement of this long-extinct species is a big reason why holiday desserts taste so good.

Why? Because, as Smithsonian Insider reports, tens of thousands of years ago, mammoths, elephants, and mastodons had an affinity for wild gourds, the ancestors of squashes and pumpkin. In a 2015 study published in the Proceedings of the National Academy of Sciences, a Smithsonian researcher and colleagues found that wild gourds—which were much smaller than our modern-day butternuts—carried a bitter-tasting toxin in their flesh that acted as a deterrent to some animals. While small rodents would avoid eating the gourds, the huge mammals would not. Their taste buds wouldn't pick up the bitter flavor and the toxin had no effect on them. Mammoths would eat the gourds and pass the indigestible seeds out in their feces. The seeds would then be plopped into whatever habitat range the mammoth was roaming in, complete with fertilizer.

When the mammoths went extinct as recently as 4000 years ago, the gourds faced the same fate—until humans began to domesticate the plants, allowing for the rise of pumpkins. But had it not been for the dispersal of the seeds via mammoth crap, the gourd might not have survived long enough to arrive at our dinner tables.

So as you dig into your pumpkin pie this year, be sure to think of the heaping piles of dung that made the delicious treat possible.