Marijuana might have a bigger role in curbing this drug abuse than previously thought. Its potential uses are actually threefold: to treat chronic pain, to treat acute pain, and to alleviate the cravings from opioid withdrawal. And it has the advantages of being much less dangerous and addictive than opioids.

The big roadblock? Marijuana’s status under federal law as a Schedule I drug—the most tightly restricted category—which makes it very difficult for researchers to study. Scientists first have to apply for a license from the Drug Enforcement Administration, which “can take people years,” says Yasmin Hurd, a neuroscientist at Mount Sinai who has a license to study marijuana and its derivatives. Another problem is sourcing. Scientists can only get marijuana from a farm at the University of Mississippi, which grows a limited variety. “You want to be able to study different formations, but if you can only get the compounds from one source, that makes it hard,” says Hurd.

This is especially relevant to Hurd’s work because her interest is not necessarily THC, the psychoactive chemical in marijuana, but cannabidiol, also known as CBD. Cannabidiol doesn’t get you high, but it affects the receptors in your brain more indirectly. In a small pilot study, Hurd has found that cannabidiol can reduce the cravings of people addicted to heroin. “They relapse because they are in conditions that induce craving,” says Hurd. By controlling their anxiety, cannabidiol also seems to be controlling their cravings.

Hurd is now running a larger trial to investigate if the substance could help people addicted to heroin, and she published a recent review on cannabidiol’s role in curbing substance abuse.

Using marijuana to treat chronic pain is a more established idea. A 2015 review of 28 randomized clinical trials found “moderate-quality evidence” that compounds derived from marijuana or synthetic versions thereof were beneficial.

Interestingly, patients already seem to be replacing opioids with marijuana for chronic pain. A handful of observational studies have also found correlations between states legalizing medical marijuana and a drop in painkiller prescriptions, opioid use, and deaths from opioid overdose. And in 2016, Dan Clauw and his colleagues published a survey of patients with chronic pain who started patronizing a medical marijuana dispensary. They cut their previous opioid use by two-thirds.

“They felt a lot better when their pain was being controlled by cannabis rather opioids because opioids have a lot of side effects,” he says. Those side effects include dizziness, constipation, sexual dysfunction and—in the case of overdoses—breathing problems. That’s because opioids receptors are also in the brainstem, the part of the brain that regulates breathing. Marijuana acts on a different set of receptors.