A new species of prehistoric flying reptile has been discovered in a vast graveyard of dinosaur fossils in southern Brazil. The newfound species, Caiuajara dobruskii, belongs to an ancient order of winged creatures known as pterosaurs. C. dobruskii had a crested head that looked like the wing of a butterfly and its wingspan reached nearly eight feet, or 2.4 meters, across, according to a study published Wednesday in the scientific journal Plos One.

Pterosaurs were a Cretaceous period reptile that lived some 228 to 66 million years ago. They were the first vertebrates to have evolved power flight and ranged in size from just 10 inches across to over 35 feet, making them the largest flying animals that ever lived.

The fossil bed found in Brazil contained hundreds of bones from roughly 50 individual pterosaurs, including partial skulls and jawbones, according to the study. The fossils represented both juvenile and adult pterosaurs. All the fossils were found in an area of just 215 square feet, which strongly suggests the ancient beasts were social animals that lived in large colonies.

The fossil graveyard was uncovered on the outskirts of the town of Cruzeiro do Oeste in southern Brazil, about 480 miles west of São Paulo. Paleontologist Paulo César Manzig, from the Universidade do Contestado, stumbled upon the ancient fossil bed in 2011 while doing research for a book on Brazilian fossils. He and a team returned to investigate.

“When we arrived at the discovery site, the bones were visible, many pterosaur bones right in front of my eyes,” Manzig told Smithsonian. “It was one of the most exciting moments of my life.”

Though pterosaur fossils have previously been unearthed in northern Brazil, this was the first time such fossils had been found in the southern part of the country, according to Discovery. Brazilian researchers say the reptiles lived in the humid regions among the ancient desert sand dunes, which served as “oases” for the winged C. dobruskii. The shapes of the fossilized pterosaur bones tipped researchers off to which branch of the pterosaur family tree the species belonged; bony ridges above the eyes and a uniquely shaped jaw suggested the fossils belonged to an entirely new species.

Scientists are not sure what to make of that bizarre crest atop C. dobruskii’s head, but they have an idea of its purpose might have been. “Some researchers think that the crests were only display structures, others envision them as being a form of sexual dimorphism — males have them, females don’t. Personally, I think it was a mix of different functions,” Alexander Kellner, a paleontologist at the Museu Nacional in Rio de Janiero and co-author on the study, told Smithsonian.

Researchers believe the flying reptiles discovered in southern Brazil probably died from drought and desert storms. The bones revealed that the pterosaurs died at different times, which suggests multiple forces – not a single event – were at play.