No matter how you feel about them, cockroaches are something special. Cut a few legs off a nymph, and they grow back. Leave a few cookie crumbs in the carpet, and the critters seem to instantly zero in on them. Expose them to fecal material, bacteria and other pathogens, homemade antibiotics will keep them healthy. On top of it all, they can eat just about anything, live in brutal conditions and laugh in the face of the toughest insecticides.

So what gives them these seeming superpowers? As Maggie Fox at NBC News reports, a new study suggests the answer is in their genes. Researchers at the Chinese Academy of Sciences in Shanghai sequenced the genome of the American cockroach, Periplaneta Americana, revealing a Swiss army knife-like set of genes that makes the insects uber adaptable.

It turns out that cockroaches have a massive genome; of the insects yet studied, the cockroach is second only to the locust. The genes of the American cockroach—which isn’t really American: it was likely transported to the Americas from Africa as early as 1625—is more closely related to termites than to the German cockroach, another major house pest that had its genome sequenced earlier this year. That’s not surprising, since termites turn out to be “eusocial cockroaches” and were moved into the same order as roaches earlier this year.

GenomeWeb reports that 60 percent of the cockroach’s genome contains repetitive elements. But it also includes 21,336 protein-encoding genes, 95 percent of which actually produce proteins. Many of those genes give cockroaches the tools to survive in urban environments. For instance, the cockroach has over 1,000 genes that code for chemical receptors that help them navigate the environment, including 154 olfactory receptors—twice as many as the other creepy-crawlies in its insect order—that allow them to pinpoint the burrito bits you dropped. It also has 522 gustatory receptors, with many of them able to detect bitterness, which may help them tolerate potentially toxic foods. The bugs also encode for certain enzymes that can help them resist pesticides and survive extreme environments.

Fox reports that during its nymph stage, the cockroach is also capable of regeneration. This special skill is the main reason behind its Chinese nickname, xiao qiang, which means little mighty one, the researchers write in their paper in the journal Nature Communications. “It’s a tiny pest, but has very strong vitality,” lead author Sheng Li tells Steph Yin at The New York Times.

The research has several applications. For instance, knowing how the roaches are able to cope with insecticides could lead to better roach control. “The harm of American cockroaches is becoming more serious with the threat of global warming,” the authors write. “Our study may shed light on both controlling and making use of this insect.”

Li also tells Yin that his team hopes to look at the potential healing properties of cockroaches. In traditional Chinese medicine, cockroaches are ground up and used for all manner of treatments thanks to its regenerative power. The team hopes to uncover the “growth factor” that makes that particular trick possible. “We’ve uncovered the secret of why people call it ‘xiao qiang,’” Li says. “Now we want to know the secrets of Chinese medicine.”

In recent years, researchers have uncovered a lot we wish we didn’t know about cockroaches. For instance, researchers have found that gut bacteria infuse roach poo with chemical cues that cause them to congregate. In other words, they like the smell of each other’s poop. Another study has shown that cockroaches have evolved to avoid the sugary baits that used to work on the pests in the 1980s and 1990s. Hopefully this latest study and future work will help scientists find a new remedy for—or another use of—the often despised but always durable cockroach.