Following the conviction of a man for driving under the influence of marijuana, an Arizona court ruled Thursday to vacate the judgment saying he was entitled the opportunity to prove that he wasn’t impaired.

The man was convicted, according to the Associated Press, after a 2015 Arizona Supreme Court decision that said medical marijuana cardholders aren’t immune to DUI charges but that they can try to prove that they didn’t have enough THC, the active ingredient in weed, in their systems to be impaired. Defendants are able to do so, the court said, through cross-examination of witnesses and by providing testimony of their own about their level of impairment.

Marijuana can be used to treat a variety of symptoms including muscle spasms caused by multiple sclerosis, nausea from cancer treatment, poor appetite and weight loss from chronic illnesses like HIV, seizures and symptoms associated with Crohn’s disease, according to WebMD. It does so by helping already-present chemicals in the body that impact pain and inflammation to work better.

A majority of the United States — 28 of them — have legalized medical marijuana in the past 20 or so years. Four states legalized the drug during the past year. Those states include Arkansas, Florida, North Dakota, Ohio and Pennsylvania. All of those except Pennsylvania and Ohio legalized medical pot through ballot measures. Arizona legalized medical weed in 2010 through a proposition.

Fewer states have legalized the use of marijuana for recreational purposes but efforts to add more states to the list appear to be gaining traction. Seven states and the District of Columbia allow recreational weed use, including California, Massachusetts and Nevada, which all passed measures in November to allow adults to use pot. Under most of those laws, adults are allowed to possess up to an ounce of marijuana and in some states are allowed to grow a limited number of weed plants in their homes.