After California legalized marijuana, some officials in the state are taking steps to amend for the old war on pot.

The latest example: San Francisco and San Diego’s district attorneys are moving to automatically clear and downgrade people’s past marijuana-related records — potentially benefiting more than 12,000 people. District attorneys are typically charged with enforcing anti-drug laws, but here they’re actually trying to undo past enforcement.

Under California’s marijuana legalization initiative, Proposition 64, people with past marijuana convictions can petition a court to have low-level offenses expunged and higher-level offenses downgraded to lower-level crimes. But the process can be costly: It can require hiring a lawyer, paying court fees, finding the time to go to court, and so on.

San Francisco and San Diego’s district attorneys are taking proactive steps, looking through past marijuana convictions on their own and taking automatic action on what they find — expunging low-level convictions and downgrading higher-level offenses.

San Francisco has so far identified 7,900 cases that may be expunged or downgraded, while San Diego has identified 4,700.

Other California jurisdictions are either letting people petition courts on their own or working through past convictions on a case-by-case basis.

California voted to fully legalize marijuana in 2016, allowing possession and, starting this year, sales for recreational purposes. It’s among nine states to have legalized, with Colorado and Washington state becoming the first two to do so in 2012.

California’s legalization initiative, however, was unique in that it addressed past marijuana convictions by giving the previously convicted a means to get records cleared or downgraded. Colorado, for example, did not let people with previous pot misdemeanors clear their records until the legislature voted to allow it in 2017, after California’s legalization measure passed. (Although Oregon allowed past record clearing in the 2015 law that codified the state’s legalization initiative, which passed in 2014.)

As the New York Times noted, past convictions can hinder various aspects of life: getting a job, finding housing, obtaining college loans, and acquiring a professional license. It can even make it hard to work for a legal pot business; in various states, previous drug convictions can ban people from working in the marijuana industry.

There is also a massive racial disparity in these kinds of convictions. Although black and white people use marijuana at similar rates, black people are nearly four times as likely to be arrested for possession, according to a 2015 report by the Sentencing Project.

The disparity applies to California: According to a 2013 report by the American Civil Liberties Union, black people are more than twice as likely to be arrested for marijuana possession compared to their white counterparts.

The proactive steps these district attorneys are taking, then, will disproportionately help people of color. And with that help, thousands may have an easier time finding jobs, housing, and a college education.

For more on marijuana legalization, read Vox’s explainer.