Some female dolphins have vaginas that bat away unwelcome penises, according to a new study.

Researchers looked at an array of dolphin species to figure out how they have sex and found that bottlenose dolphins and common porpoises have genitalia that’s evolved to act as a barrier to unwanted fertilization. Their findings were published in Proceedings of the Royal Society.

Scientists have long had trouble figuring out how dolphins — or cetaceans in general — get it on. They live far from shore, in the middle of the ocean and are always on the move, making it hard for researchers to observe them for very long, let alone catch them having sex.

“There are very few studies of the mating behavior of cetaceans because of these challenges,” Dara Orbach, an author of the study, told Motherboard. “I’ve done several of them, so I can tell you.”

What researchers do know is that when male bottlenose dolphins are looking to mate, they form packs of two to four dolphins in order to fight off any competitors. These packs then surround a female and take their turns – giving the female little to no choice on who gets her pregnant.

Researchers also know that dolphin and cetacean penises come in a ton of different shapes and sizes, but knew little about cetacean vaginas.

So Orbach and her co-authors collected dead dolphins — all of which had died of natural causes — to figure out how dolphins mate. They detached the genitals from common and bottlenose dolphins, common porpoises and common seals, removing the vaginal opening, clitoris, cervix and ovaries from the females and the “penis tip and the entire shaft through to the pelvic bone,” from the males, according to Orbach.

Then they inflated the penises with saline to simulate an erection and compared them with silicone molds of the dolphin vaginas. They took CT scans of the penises inserted into the vaginas to figure out how they fit.

In the common porpoise and bottlenose dolphin, they found that the females had an extra fold on the outside of their vagina. This allows the female to obstruct a penis from penetrating her, which seemingly gives her some choice in the mating process.

“It might appear behaviorally that females are very passive,” Orbach told New Scientist. “But looking at the reproductive anatomy, we’re learning that they have all sorts of cryptic ways to control paternity.”