Cockroaches are often associated with dirty kitchens and grimy bathrooms - scuttling away as soon as you enter the room and turn on the light. But pest controllers aren't the only people interested in them - these insects are inspiring research into antibiotics, robots and mechanical limbs, writes Mary Colwell.
In Havana the native bright green Cuban cockroach is often kept as a pet and the insect even appears in old folktales. In one story, a beautiful young Cuban cockroach called Martina tests the character of her suitors by annoying them when they come to visit.
"Drop coffee on their shoes to see how they react," recommends her wise grandma. "It is very important to know what your future husband is like when he is angry - the coffee test never fails."
When faced with soaking wet shoes, her rich suitors show their true colours. A kind and gentle but poor hopeful passes the test though, and the couple live happily ever after.
Wise and beautiful are words not often associated with these creatures but their bad reputation is not always justified. Out of the 4,500 known species, only four are considered pests. Most don't live near human homes and they perform a vital ecological role, eating dead and decaying matter.
Some species are exquisite with brilliant colours and patterns. Some are social and make collective decisions, passing on information about food and shelter. Others are solitary. Some pair up and raise their young together. They can hiss, sing and make drumming sounds to attract a mate, and they are supremely hardy, surviving on the most meagre rations for months on end. One, the Eublaberus posticus, can survive for a year on water alone.
The heaviest, the subterranean rhinoceros cockroach, weighs in at 35g, measures 8cm in length, and lives in Australia. One of the smallest is a pest commonly found in Europe and North America - the German cockroach, which is just over 1cm long. Martina and her grandma might be interested to know that coffee grounds are often used as bait to trap them.
Find out more
But rather than finding them repulsive, scientists see them as a source of inspiration. In 1999, the way cockroaches moved inspired Prof Robert Full at the University of California, Berkley, to devise a six-legged robot that moved faster and more easily than any others.
In his 2014 TED talk he explained how the insects' springy legs, rounded body shape and flexible exoskeletons - made up of connected tubes and plates - enable them to negotiate complex terrain. Footage of cockroaches on mini treadmills and assault courses shows how stable they are - and if they do happen to flip over, they can use their wings to right themselves.
The insects' legs are also providing ideas for researchers designing the next generation of prosthetic legs for humans. And the mechanics of their springiness are the basis for the grip in a new mechanical hand. The aim, according to Robert D Howe, head of Harvard's Biorobotics Laboratory, is to produce a hand that can "glide along objects until it wraps around them, just like a human hand lifting a coffee cup".
Then there's the robotic roach - a fusion of live cockroach and mini-computer, surgically attached to its back. By sending messages to the computer, the cockroach can be directed to places that are hard for to humans to access, such as collapsed buildings or broken sewers, where they collect data.
"When I first saw them, my hair stood up," says the lead researcher on a project at Texas A&M University, Hong Liang. "But I went on to keep some in my office as pets for a while. They are actually beautiful creatures. They are constantly cleaning themselves."
In June students from Shanghai Jiao Tong University demonstrated how they could control cockroaches with their minds. Translating human brain waves into electrical impulses, they directed a cockroach attached to receiver down different shaped tunnels - simply by thinking about it.
There is cockroach-related research in medicine too. Scientists had long wondered how roaches could spend their lives in dirty environments with no ill effects and it turns out they produce their own powerful antibiotics.
They might hold the key when it comes to developing drugs to knock out the most virulent bacteria that make humans ill, such as E. coli, MRSA and other superbugs resistant to many existing treatments.
Cockroach cures are nothing new, though. In the 19th Century Lafcadio Hearn, a journalist and writer who travelled through the southern states of the US, noted, "For tetanus, cockroach tea is given. I do not know how many cockroaches go to make up the cup; but I find faith in this remedy is strong among many of the American population of New Orleans."
Today, hospitals in parts of China use a cream made from powdered cockroaches to treat burns and a cockroach syrup is sometimes given to patients to alleviate the symptoms of gastroenteritis.
When Wang Fuming realised demand for the insects was growing he set up a cockroach farm in Shandong province in eastern China. He keeps 22 million at a time in his underground bunkers and says that since 2010 the price of dried cockroaches had risen tenfold.
The insects can also be eaten - in China, the American cockroach is the preferred delicacy. Double frying them in hot oil is said to give them a crispy outer and succulent inner with the consistency of cottage cheese. A sprinkling of chilli gives an extra zing.
As the human population and its need for mass produced protein grows, perhaps the reviled cockroach will one day feed the world. If only people could be a little less squeamish.
More from the Magazine
In 1950 the East German government claimed the Americans were dropping potato beetles out of planes over GDR fields in an attempt to sabotage their crops. Was it true, or an example of Cold War propaganda?
Subscribe to the BBC News Magazine's email newsletter to get articles sent to your inbox.