SAN FRANCISCO (AP) — A bill requiring California prosecutors to erase or reduce tens of thousands of marijuana criminal convictions was approved by the state Legislature on Wednesday and now awaits Gov. Jerry Brown’s signature.

When voters passed Proposition 64 in 2016 to allow adult use of marijuana, they also eliminated several pot-related crimes. The proposition also applied retroactively to pot convictions, but provided no mechanism or guidance on how those eligible could erase their convictions or have felonies reduced to misdemeanors.

The Senate passed a bill Wednesday that would make that happen.

The bill orders the state Department of Justice to identify eligible cases between 1975 and 2016 and send the results to the appropriate prosecutor.

The state DOJ estimates that almost 220,000 cases are eligible for erasure or reduction. The DOJ has until July 1, 2019, to compile the list of eligible cases and forward it to the appropriate district attorney’s office.

Prosecutors then have until Jul 1, 2020, to decide which cases on the DOJ list they want to challenge.

Since passage of Proposition 64, most California district attorneys have said they didn’t have the resources to review their records to identify eligible cases.

Non-violent, felony convictions for possession or distribution of less than an ounce of marijuana are eligible for reductions to misdemeanors, though prosecutors can challenge applications based on the person’s criminal history. Felons with serious convictions such as murder, rape and robbery that are considered “strikes” under a California law requiring stiff sentences for repeat offenders.

Some eligible people hired attorneys and petitioned courts on their own and prosecutors in San Francisco and San Diego counties reviewed past cases and took action on their own to erase or reduces thousands of cases combined.

But the vast majority of eligible people have not applied for relief, many of them not even knowing they qualified. Others saw the process as too expensive and complicated.

The bill was introduced by Democratic Assemblyman Rob Bonta, who represents parts of Oakland, California, and passed the lower house earlier this year.

It passed the Senate 22-8 with bipartisan support on Wednesday.

Democratic state Sen. Scott Wiener of San Francisco, who supported passage, said many with marijuana convictions don’t even know they are eligible.

Wiener said the bill “creates a simpler pathway for Californians to turn the page.”

Republican State Sen. Joel Anderson, who represents a rural district east of San Diego, said the bill will enable some eligible people regain their gun rights by reducing felonies to misdemeanors. “This bill will take those people off the prohibited list, save us time and money,” Anderson said.