I have a cute dog that’s something of a beagle mix, and as tends to be the case with canines from the hound family, he’s essentially a nose with four legs. If he picks up the faintest scent of food, no matter the time of day, he makes a beeline for the source in the hopes that he might get a meal, or at the very least, a few scraps. Walking him, as you might imagine, is also something of an adventure. With his nose practically glued to the ground and leading the way, he’ll take his sweet old time sniffing literally any and everything in sight.

Dogs, of course, have incredibly powerful noses thanks to their 220 million olfactory receptors. Human, in stark contrast, only have 5 million. What’s more, dogs can not only pick up scents at impressively large distances, their nostrils can operate independently of one another, thereby allowing them to not only detect an interesting scent, but to glean a sense of its location as well.

As impressive as that is, it turns out that a dog’s sense of smell may be more advanced than initially believed. According to a new research study published in the Journal of Comparative Psychology, dogs who are hot on the trail of a specific scent can actually form an expectation in their brain of what object they’re looking for and expecting to find. In other words, a dog’s sense of smell is far more nuanced than simply categorizing a specific scent as good or bad.

As to how the research was conducted, dogs were given a scent associated with one of their favorite toys. Predictably, the dogs followed the scent down a path whereupon some of them encountered an object that was foreign to them, thus setting up a scenario where they might exhibit behavior associated with surprise.

Gizmodo explains:

The researchers set up one of two possible scenarios for the dogs: After following a scent trail made with one of the two toys, the dogs either found the matching toy (the normal condition scenario) or the other toy (unexpected condition).

In the normal condition scenario, the dogs didn’t do anything out of the ordinary. But in the unexpected condition, the dogs arrived at the toy and exhibited a moment of hesitation—a brief pause that basically said, “What the hell is this?” In other words, they had been searching for a specific object and were surprised to find something different. After the hesitation, however, they went back to searching for the object that matched the scent.

It’s a fascinating study, to be sure, and the next time you happen to see your dog rummaging through the trash, he or she might just actually be looking for something specific.