This weekend, children armed with pillowcases and plastic pumpkins will haul in millions of pounds of Halloween candy wafting familiar scents like chocolate, peanut butter and the luxurious, uniquely enticing aroma of caramel. Until recently, scientists did not know precisely how humans process this rich, buttery smell. But now a new study in the Journal of Agricultural and Food Chemistry pinpoints the specific sensor, called an olfactory receptor, responsible for detecting it.

Luis Saraiva, a neurogeneticist at Sidra Medicine in Qatar who was not affiliated with the new work, says studies estimate that humans can distinguish between 10,000 and one trillion different odorants, the name scientists give to airborne chemicals that have a smell. Such fine distinctions occur via special brain cells called olfactory neurons in the upper nose that reach all the way through tiny holes in the skull, and directly into the brain. When inhaled odorant molecules fit into a neuron’s corresponding olfactory receptor, the neuron fires, and the brain matches it to an odor, or perceived smell. “You smell a molecule,” Saraiva says, “and you say, ‘Oh, this smells like mint, or like caramel.’”

Each olfactory neuron senses molecules with one of about 400 different types of olfactory receptors, and the various combinations of these neurons activated in the nose allow us to distinguish between a vast range of different smells—and to know when the kids have been sneaking candy before bed.

But knowing exactly which chemical each receptor recognizes is not easy. Scientists cannot yet predict a chemical’s smell simply from its molecular shape, explains lead author Dietmar Krautwurst, a molecular cell biologist at the Technical University of Munich. For example, the chemical responsible for caramel scent, called furaneol, has also been described as smelling like strawberries or cotton candy. But just a tiny tweak in the chemical structure makes it recognizable by a different receptor, giving it a savory and herby scent instead, Krautwurst says.

Krautwurst’s team experimented with special cells genetically engineered to light up when their olfactory receptors recognize an odorant. After testing all the human olfactory receptors (as well as about 200 of the most common genetic variants), only the cells with a receptor called OR5M3 glowed when they were exposed to furaneol; this indicated it was the receptor responsible for handling the smell of caramel. The researchers also confirmed another team’s finding that a different receptor called OR8D1 recognized furaneol’s herby cousin, the chemical sotolone.

“This is really a lot of work, to be able to identify the receptors,” says University of Massachusetts, Amherst sensory scientist Alissa Nolden, who was not involved with the study. Furaneol and sotolone are important natural flavorings in the food industry, which Krautwurst notes is constantly grappling with maintaining product consistency despite varying and unpredictable access to raw ingredients. Nolden adds that increasing consumer demands for more natural ingredients also drives companies to seek new ways to recreate familiar flavors. Such flavors are shaped by both how a food tastes and how it smells.

By identifying the olfactory receptors for these and eventually other odorants, Krautwurst says researchers can better understand how odorant molecules fit into their receptors—and can then be able to predict how newly designed or discovered odorants might interact with the receptors, thus determining the scent they will trigger.

Krautwurst adds that knowing which odorant receptors detect certain smells can also help food scientists assess products more objectively than human sensory experts currently can. For example, isolated OR8D1 receptors could help sense small amounts of sotolone, which sometimes causes unpleasant “off” smells, in aged beers and some soft drinks.

Although this discovery might seem most pertinent to the food industry, it also underscores how little scientists know about our vital sense of smell. Detecting and understanding odors was important for early humans to find food or avoid dangerous situations such as fire or rotting meat. But nowadays, Saraiva says, many people overlook the importance of smell and often relegate it to something more aesthetic than anything else.

Now that COVID-19 has temporarily deprived many of this sense, Nolden says, people are realizing how life-altering it is to not be able to smell—not just their food, but the people around them. “Smelling your baby, smelling your kids, smelling your partner,” she says, “are very intimate sensations for smell that you no longer have.”

Evolution “would not invest millions of years just for something that is nice to have,” Saraiva says. “It needs to be a must-have.”