RALEIGH, N.C. (WNCN)—A settlement was reached with Walmart on allegations that it “contributed to the opioid addiction crisis by failing to appropriately oversee the dispensing of opioids at its stores,” Attorney General Josh Stein said in a release.

Along with over $3 billion that will be divided among the states and tribes, Walmart will also have to improve how its pharmacies handle opioids, officials said.

Attorney General Stein said that the opioid epidemic has impacted too many families and the companies are being held accountable for their part in the crisis.

“Too many families have lost loved ones to the opioid epidemic, and too many people have lost years of their lives to addiction,” said Stein. “My fellow attorneys general and I are holding accountable the companies that created and fueled this crisis. As a result of our efforts, working alongside lawyers representing cities and counties, Walmart is committing to pay $3.1 billion and to improve the way it does business. These meaningful resources will help people suffering from opioid addiction get the treatment and recovery services they need, and the changes to the way pharmacies operate will ensure that this never happens again. This deal with Walmart adds to the important progress we’ve already achieved through our settlements with the opioid manufacturers and distributors – and we’re not done yet.”

Those changes at Walmart’s pharmacies will include: “[b]road, court-ordered requirements, including robust oversight to prevent fraudulent prescriptions and flag suspicious prescriptions,” officials said in a release.