Distant human relatives lived and evolved in trees shortly after the big dinosaurs went extinct, according to an analysis of bones from the earliest known primates.

The bones are 62 million years old and come from a small mammal called the Torrejonia, part of an extinct primate family known as plesiadapiforms that date back to a time only a few million years after non-avian dinosaurs went extinct. Although scientists have believed they lived on the ground and fed on the insects there, based on fossils of their cranium and teeth, a study in the journal Royal Society Open Science says Torrejonia’s bones, which were found in New Mexico, tell a different story: of an animal climbing and hanging on to tree branches.

Read: Ancient Child’s Skeleton Shows How Humans Evolved to Run

“This is the oldest partial skeleton of a plesiadapiform, and it shows that they undoubtedly lived in trees,” lead author Stephen Chester said in a statement from Yale University. “We now have anatomical evidence from the shoulder, elbow, hip, knee and ankle joints that allows us to assess where these animals lived in a way that was impossible when we only had their teeth and jaws.”

It was the flexibility in those joints that helped scientists determine that the primates hung out in trees, among other skeletal features that were suited for such a lifestyle.

The study says that the clues about ancient primates being tree-dwellers suggests that “primates are primitively arboreal,” as opposed to their tree-climbing ways simply evolving separately among different groups of primates. And the researchers say their analysis confirms the prehistoric plesiadapiforms that Torrejonia called its family were indeed the earliest primates out there.

“To find a skeleton like this, even though it appears a little scrappy, is an exciting discovery that brings a lot of new data to bear on the study of the origin and early evolution of primates,” senior author Eric Sargis said in the Yale statement.

There were more than 20 bones in the partial skeleton, including pieces of the skull, limbs, jaw and teeth. Having the teeth there was important because it helped identify the animal, as many ancient specimens are classified based on dental features.

Read: Hobbit Bones Show How Ancient Humans Evolved

The plesiadapiforms may have been a sort of transition animal, a link between primate ancestors and primates themselves, based on anatomy that is not quite how we understand primates to look. According to Yale, those more primitive features include “outward-facing eyes” and the belief that they “relied on smell more than living primates do today.”

That makes sense given that scientists think primates started to split off the evolutionary tree from other animals about 65 million years ago. They evolved into many kinds of animal species we know and love today, like humans, chimpanzees, gorillas and lemurs, to name a few.