Over 18 million American men over 20 years old suffer from erectile dysfunction, a condition characterized by the inability to keep an erection. It’s a complex disorder brought on by a number of factors, but it’s almost always devastating for the man it affects — causing him to lose confidence in himself and different aspects of his life. The stress it causes can deteriorate relationships and lead to lost productivity at work. Health problems aren’t uncommon either. But there’s good news in all the bad; a new study finds exercise may be a simple way to get things going under the sheets again.

Several studies have shown that erectile dysfunction is somehow linked to problems with cardiovascular health — which one comes first has been the question. It makes sense; the penis becomes erect through a complex system of blood vessels and spongy tissue called the corpora cavernosa — this is where the blood gets trapped, causing the erection. When problems arise through this system, whether they’re caused in the brain or through problems with the blood vessels, the penis can’t get erect.

Past research has suggested that living a healthier life full of exercise and a good diet can bring men back to sexual health. But according to researchers at Cedars-Sinai Medical Center in Los Angeles, most of these studies underrepresented African-American men. “This study is the first to link the benefits of exercise in relation to improved erectile and sexual function in a racially diverse group of patients,” said senior author of the study Dr. Adriana Vidal, of Cedars-Sinai Samuel Oschin Comprehensive Cancer Institute and Department of Surgery, in a press release.

Vidal and her team looked at self-reported physical activity among 300 men, and then categorized them into categories: sedentary, mildly active, moderately active, and highly active. These men also reported their levels of sexual function, including their ability to have an erection and orgasm, as well as the quality and frequency of their erections and overall sexual function.

They found that men who exercised the most were also the most likely to have higher scores in sexual function. Specifically, those who expended 18 METS, or metabolic equivalents, per week were most likely to enjoy sex. METS is a physiological measurement that denotes the amount of energy a person spends on a specific activity, as well as the intensity of it. According to the researchers, 18 METS was equal to about two hours of strenuous exercise like running or swimming, 3.5 hours of moderate-intensity exercise, or six hours of light exercise.

It’s easy to see how erectile dysfunction subsides with exercise. Not only does it help reduce cardiovascular risk factors, but it’s also been shown to reduce stress, another cause of the condition. The best part is that it doesn’t take much effort to get started on an exercise routine. “When it comes to exercise, there is no one-size-fits-all approach,” co-author Dr. Stephen Freedland said in the release. “However, we are confident that even some degree of exercise, even if it’s less intense, is better than no exercise at all.”

Source: Simon R, Howard L, Zapata D, Frank J, Freedland S, Vidal A. The Association of Exercise with Both Erectile and Sexual Function in Black and White Men. The Journal of Sexual Medicine. 2015.