Anyone who has been around a dog for long knows they can understand human language and that they watch our every move – especially when food is involved.

But a new study shows they have a whole level of complex memory that’s never been proven before to exist in animals other than humans.

"The results of our study can be considered as a further step to break down artificially erected barriers between non-human animals and humans,” Claudia Fugazza of Eötvös Loránd University in Budapest, Hungary, said in a statement.

Smart Dog study. Claudia Fugazza / MTA-ELTE Comparative Ethology Research Group

"Dogs are among the few species that people consider 'clever', and yet we are still surprised whenever a study reveals that dogs and their owners may share some mental abilities despite our distant evolutionary relationship."

The team was looking for evidence of episodic memory – which is an orderly memory of events, usually associated with self-awareness.

It took some tricky training to make sure the dogs weren’t just trying to please.

Related: How Dogs Keep the Homeland Safe

“Dogs were first trained to imitate human actions on command,” Fugazza’s team wrote in their report, published in Current Biology.

Then they were trained to simply lie down after any command. The idea was to trick the dogs into forgetting that they had been trained to imitate the trainer.

“These findings show that dogs recall past events as complex as human actions."

“We then tested whether dogs recalled the demonstrated actions by unexpectedly giving them the command to imitate, instead of lying down.”

So for instance, a trainer would tap an open umbrella, then take the dog behind a screen for a while, return the dog to the room, where it would lie down. Then the trainer would give the unexpected command "Do it."

Many, but not all of the dogs would repeat the action -- walking up to the umbrella and tapping it with a paw. There's a video of one experiment here.

Even though the dogs could not have been expecting that they would be asked to imitate a trainer’s actions, they could. The actions were odd, such as hitting an umbrella or walking around a bucket, so the dogs had to have remembered what the people did, the researchers said.

“These findings show that dogs recall past events as complex as human actions even if they do not expect the memory test, providing evidence for episodic-like memory,” the team concluded.

So be careful what you do in front of your dog.