As rates of overweight and obesity, and their resulting disorders, continue to rise in the U.S., chances are rates of erectile dysfunction will, too — sorry guys. Previous research has found these links to be pretty solid, especially among people with diabetes. Yet, even though these risks exist, there are steps a man can take to improve erectile dysfunction (ED). The simplest one, a new study finds, may be to drink a few cups of coffee a day.

With over 85 percent of Americans drinking coffee each day, the new study investigated the relationship between ED and caffeine consumption among men who are overweight, obese, hypertensive, or diabetic. They found that all but those who were diabetic reduced their risk of ED by drinking two to three cups of coffee a day, the equivalent of about 170 to 375 milligrams of caffeine. “Diabetes is one of the strongest risk factors for ED, so this was not surprising,” said Dr. David Lopez, lead author of the study and an assistant professor at the University of Texas Health and Science Center’s School of Public Health.

ED is the inability to have or maintain an erection during sex, regardless of how much mental or physical stimulation there is. The penis contains two chambers of spongy tissue containing nerves, muscles, blood vessels, and space. When the muscles of these chambers can’t relax, blood flow is restricted from entering the penis, and thus ED ensues. The condition affects as many as 30 million American men, according to the National Institutes of Health. Though incidences of ED increase with age, being obese, overweight, hypertensive, or diabetic could increase the risk of it occurring at a younger age.

The researchers suggested the reason coffee improved ED in participants was because caffeine “triggers a series of pharmacological effects” that lead to the relaxation of arteries and smooth muscles throughout the penis, thus increasing blood flow through the penis. These speculations support previous research showing that caffeine improves blood flow throughout the body. A 2013 study, for example, found people who drank one cup of coffee experienced a 30 percent increase in blood flow over a 75-minute period when compared to people who drank decaffeinated coffee.

For the study, Lopez and his team looked at data from the National Health and Nutrition Examination Survey, which included a question about ED, and also collected information on food and drinks consumed. While coffee is popular, other sources of caffeine included soda, tea, and energy drinks. The researchers cautioned that although these drinks may improve ED in people with the aforementioned conditions, the study didn’t not prove causality, and thus further research was necessary.

Source: Lopez D, Wang R, Tsilidis K, et al. Role of Caffeine Intake on Erectile Dysfunction in US Men: Results from NHANES 2001-2004. PLOS One. 2015.