Illinois residents with minor marijuana offenses on their record can finally exhale.

Gov. J.B. Pritzker (D) signed HB 1438 this week, which legalizes the use of cannabis in the state by residents 21 and over. It also enacts a process by which about 315,000 Illinois residents with cannabis-related criminal records ― representing some 770,000 cases ― are eligible to have their records expunged, per the Marijuana Policy Project, an advocacy group.

Under the new law, Illinoisans who were charged with possession of under 30 grams of marijuana (that’s slightly more than an ounce) prior to legalization will have their records automatically expunged, as long as violent crime wasn’t also part of the charge. Those convicted of possessing the same amount will still have to go through a court proceeding.

Residents whose convictions were for amounts between 30 and 500 grams (that’s a little more than a pound) won’t receive automatic clemency. They’ll have to individually petition the court, which will decide on a case-by-case basis.

In addition to expunging individuals’ records, the new law also contains a “social equity” component that incentivizes people and communities disproportionately impacted by the war on cannabis to apply for business licenses.

“The most historic aspect of this is not just that it legalizes cannabis for adults but rather the extraordinary efforts it takes to reduce the harm caused by the failed war on marijuana and the communities it hurt the most,” state Sen. Toi Hutchinson, who co-sponsored the bill, said of the legislation earlier this year.

MPP concurs. In an overview of Illinois’ new law, the group labeled it “one of the most sweeping criminal justice reforms so far in the cannabis movement.”

The law goes into effect Jan. 1, 2020. Alexis Arnold contributed reporting.

CORRECTION: A previous version of this article indicated anyone in Illinois convicted with under 30 grams will be eligible for automatic expungement. Only those who were charged but not convicted will qualify. Language has been amended to clarify how many Illinois residents this may affect.