In mid-July, a frustrating search for four missing men in Bucks County, Pennsylvania ended with the discovery of Dean Finocchiaro’s corpse buried in a suburban farm. The grisly unearthing led the killer, Cosmo Dinard, to confess to the murders of all four men. Though solving the crime required about 50 law enforcement investigators and the FBI, the it couldn’t have been done without the cadaver dogs. They managed to sniff out Finocchiaro’s body, even though it was buried 12 and a half feet underground.

These dogs have their work cut out for them. Unlike drug- or bomb-sniffing dogs that just need to identify a few specific scents, cadaver dogs must learn to identify hundreds.

Training requires a lot of exposure to a lot of putrid odors, but acquiring isolated versions of those odors isn’t easy. That’s why there’s a macabre realm of science research focusing on identifying the smells that leach out of the dead — and isolating them for dogs (and their humans) to identify.

Cadaver dogs usually start their training between the ages of 18 months and 2 years. Instagram / SearchDogZane

When cadaver pups first start out, they practice not with real corpses but with synthetic cadaver scents. These are a real thing: the chemical giant Sigma-Aldrich makes three different corpse scents for canine training, including “recently dead,” “decomposed,” and “drowned victim.” But when it comes to the scent of dead bodies, nothing beats the real, multifarious stench.

Human bodies decompose in five basic stages, and each of those stages produces dozens of different odors. In an attempt to classify them, researchers from Oak Ridge National Laboratory and the University of Tennessee teamed up with the FBI to build a “decompositional odor analysis database.” In a 2004 article in the Journal of Forensic Science, they explained their process: First, they buried four bodies in graves between 1.5 and 3.5 feet deep and, over the course of the next year and a half, used traps to capture the air that emanated from the rotting bodies through the ground. After analyzing 374 samples from the graves, they found out just how many volatile chemicals the human body makes when it decomposes: a whopping 424.

Many of these scents are likely identifiable only by trained dogs, but a few will stick out even to the common human nose: cadaverine, putrescine, skatole, and indole. As Inverse has explained in the past, these compounds smell particularly rank:

Cadaverine, the smell of which is officially classified as “unpleasant,” is responsible for the foul smell of rotting flesh and is also found in urine and semen. Putrescine, which smells fairly similar to cadaverine, is also what makes bad breath bad. Skatole — which is also found in coal tar — and indole are major components of feces. Strangely enough, skatole and indole are also used in low concentrations to develop flowery scents for perfumes.

Complicating the smell of death is the fact that the environment in which a corpse decays affects what odors are produced. In 2016, researchers from the University of Leicester reported that soft tissue that decomposes in the absence of oxygen breaks down differently than soft tissue in the presence of oxygen; in other words, corpses in the ground and above ground rot differently. Studying gas samples taken from pig hearts, the researchers found that decomposition in oxygen-free settings produces a lot more of indole, while the presence of oxygen tends to lead to high levels of acetone.

Of course, when it comes to training cadaver dogs, nothing beats the real, gruesome thing. Trainers can bring dogs to outdoor forensic decomposition laboratories, like Western Carolina University or the Penn Vet Working Dog Center to practice finding actual dead bodies. As with all dog training, sniffing out cadavers comes down to manipulating the dogs’ “response and reward systems” through positive reinforcement.

Despite the fact that a dog’s sense of smell is 100 to 1,000 times more sensitive than a humans, these dogs still need to put in a lot of practice — the training process usually spans from 18 months to two years. But all that time and dogged sniffing pays off: When it comes to finding a corpse buried deep underground — even if it’s “hundreds of years old,” according to cadaver dog expert Cat Warren — these death-sniffing pups are still more effective than any machine.