Squirrels are among the peculiar menagerie of creatures who’ve made a home for themselves where humans live. Like pigeons, they’ve figured out how to continue their ways in our parks, cities, and towns, tucking away nuts in the walls of houses, in basements—and in the lawns of institutions of higher learning.

At the University of California, Berkeley, that behavior is the focus of a recent paper by comparative psychologists. Having performed a number of experiments with their small furry neighbors, Mikel Delgado and her colleagues discovered that squirrels are not putting nuts away willy-nilly. When they have the chance, they'll sort their bounty by type, like nuts with like nuts. That suggests they’re remembering not only the locations of their caches but, intriguingly, their contents.

The work began some years ago, with this paper just the latest in a long string.“The question always is, given that squirrels bury so many nuts, how do they decide where to bury them and how are they able to find them again?” says Delgado, who performed the research as a graduate student and now is a postdoctoral researcher at University of California, Davis.

If you’ve ever watched a squirrel with a nut, you might have noticed that they turn them over and over in their paws, bobbing their heads. That seems to be a way for them to judge the weight and other qualities of the nut they are holding, which suggests that information is useful for them in their subsequent stashing. Perhaps, the scientists thought, the squirrels were sorting the nuts somehow.

Delgado and her colleagues designed a series of experiments in which they gave nuts to 45 squirrels and watched to see where they put them. Each squirrel was given an almond, a walnut, a pecan, or a hazelnut, then the researchers followed them from a distance to see where on the Berkeley campus they cached it. After it was hidden, the researchers took a GPS reading at the site. Half the squirrels got their next nut right then and there, while the others were lured back to the starting point. Not all squirrels are very patient with this, it turns out. “[Sometimes it] takes a while, because you have to convince them to come back,” says Delgado. The intent was to mimic a situation where a squirrel has found a tree flush with nuts that they’ll return to.

This process repeated 16 times, so each participant got 16 nuts. Some squirrels got theirs in runs of the same kind—four walnuts, then four almonds, and so on—and some got them in no particular order. This was to test whether they would cache the walnuts together, for instance, even if they got lots of other kinds of nuts in between.

When the researchers tallied up the contents of the caches, they discovered that the squirrels that got their nuts in the same place every time would group the same kinds of nuts together, a process called “chunking” in cognitive science. “That is pretty cool because it suggests they can remember” where they put certain types of foods for at least a few hours, says Delgado.

When the foraging was spread out over the campus, the squirrels wouldn’t go all the way to the last almond when they got a new one, however. Instead, they made caches of mixed nuts along their route. Chunking wasn’t a universal strategy, which suggests it takes some mental resources to keep track of where that last nut of that particular kind went. Sometimes it’s helpful; sometimes—perhaps when a squirrel is already pretty far away from its first caches—it’s not worth the strain.

It’s fascinating to think that right under our noses squirrels are engaging in some complex sorting processes. Then again, this is a species that lives for months on food hidden all across the landscape, in patterns that researchers are still working to understand. That may shame those of us who can’t find that butter we know we bought, or that stray can of beans that turns up years later. Perhaps if we paid a little more attention to creatures living around us, we could pick up a few tips.