Sharks have a reputation for being mindless, stomach-driven killing machines. But, just as your mother warned, you can’t judge a book just by its blood-soaked cover.

A new study testing the intelligence of the grey bamboo shark has shown the species’ amazing intellectual capabilities as well as their ability to remember certain information for at least a year. According to BBC Earth, this cognitive capacity puts them in competition with other animals known to have enduring memories, including crows and some primates.

The study, recently published in the journal Animal Cognition, had juvenile sharks undergo different cognitive experiments. In one, the animals were placed in a holding tank and taught through a food-reward system to identify either a triangle or a square by touching their noses to the projected image.

A researcher then tested whether the sharks could transfer this skill. Would they still be able to identify the appropriate shape even when depicted in an optical illusion called Kanizsa figures? More often than not, they could. The sharks’ wits remained razor sharp when subjected to different experiments asking them to identify differing line lengths which were then also obscured by optical illusions.

At the end of these intelligence experiments, some 50 months after the start of the study, the researcher tested the grey bamboo sharks to see if they still remembered the first experiments’ training. “Up to 50 weeks later, almost all the sharks still remembered which shape to select,” reports BBC Earth.

So what’s the biological purpose of all of these shark-smarts? BBC suggests that the mostly bottom-feeding sharks’ “ability to fill in information from incomplete visual cues most likely translates to abilities that increase their chances of survival in the wild.” In other words, there’s an advantage to being to identify—and remember—varied prey in the sand or a safe little nook from which to hide from predators.