There’s been a lot of scientific debate over the question: “Are well-behaved men more likely to get married. Or does marriage make men behave better?” Well, a new study shows it’s a little of both.

Researchers at Michigan State University followed hundreds of male twins from age 12 until their 29th birthday. They tracked things like how often each boy was in a physical fight, hospitalized because of an accident, or arrested. The result: The men with the fewest black marks were TWICE as likely to be married. And the men who’d gotten in the most trouble were still bachelors at the end of the study. Researchers believe that the biggest reason is that women find anti-social behavior unattractive. So, they skip over the “bad boys” when they’re looking for a mate.

But, marriage also improves male behavior. In the cases where one twin married and the other didn’t, the unmarried one was more likely to be arrested, get fired from a job, or have a medical emergency related to a fight or an accident.

It's not clear why men's behavior improves after marriage. But the scientists suspect that married men often feel like they “have more to lose” if they get into trouble.