California is expected to receive about $470 million from a multistate settlement with CVS over allegations that the pharmacy chain contributed to the country’s opioid crisis, the state attorney general’s office said Tuesday.

Last year, CVS Health and Walgreens agreed to pay about $5 billion each to settle a raft of lawsuits brought by state and local governments accusing the chains of filling prescriptions that should have been flagged as inappropriate, helping to fuel an epidemic that has killed more than half a million Americans over the last 20 years.

The funds were to be split among the participating states after they approved the agreements with each company.

“Today, we begin the year with another win in our fight to hold corporate giants to account for their role in fueling the opioid crisis,” California Atty. Gen. Rob Bonta said in a statement Tuesday. “The funds from this settlement will help bring much-needed relief to our communities and will ensure CVS changes its business practices to keep such a crisis from ever happening again.”

Most of the money from the settlement is required to be used for treatment and recovery services for people struggling with opioid abuse.

CVS will be required to implement additional employee training and investigate potentially suspicious prescriptions. The company’s pharmacies will be subject to site visits and compliance reviews.

Earlier in the long-running U.S. opioid crisis, most overdose deaths involved prescription drugs. Many people with opioid-use disorder moved to heroin as officials and healthcare providers sought to make prescription opioids harder to abuse and obtain.

In recent years, deaths have soared due largely to illicitly produced fentanyl.

Last month, the attorney general’s office announced that California would receive more than $500 million from the Walgreens settlement.

The state is also eligible to receive $265 million from a similar set of lawsuits against Walmart.