In 2010, Florida was a center of “pill mills,” unofficial clinics that dispensed painkillers with almost no medical exam. Pill mills helped fuel the opioid abuse epidemic raging across the U.S. by giving out huge amounts of prescription opioids like oxycodone in exchange for cash. Back then, Florida was notorious for painkiller abuse, home to 93 of the top 100 oxycodone-dispensing doctors in the U.S., according to The Tampa Tribune.

But in 2010 and 2011, Florida outlawed pill mills in order to curb opioid abuse — and the crackdown was drastically effective, according to a new study published in the American Journal of Public Health. Conducted by Johns Hopkins Bloomberg School of Public Health researchers, the study attributed 1,029 saved lives over the course of a 34-month period to the shutting down of these pill mills. In addition to lowering the rate of opioid deaths, the researchers found that shutting down pill mills may have also contributed to a lower rate of heroin deaths in Florida.

“An added benefit of Florida’s increased oversight of unethical businesses and providers dispensing large quantities of narcotics may be that they may have prevented new cases of heroin addiction from developing as well,” Alene Kennedy-Hendricks, assistant scientist in the Bloomberg School’s Department of Health Policy and Management, said in the press release. “Other states should consider restrictions on pill mills as one potential way to reduce prescription painkiller overdose deaths.”

The researchers compared opioid death trends in North Carolina and Florida to help gauge how the crackdown on pill mills changed the painkiller landscape in Florida. They found that from March to December 2010, the prescription painkiller overdose death rate dropped 7.4 percent compared to the number of deaths that would have been expected if no legal action had been taken against pill mills. The rate continued to drop 20.1 percent in 2011, and 34.5 percent in 2012.

The results are encouraging, despite the fact that the country as a whole seems to be falling deeper into an epidemic. According to the CDC, the number of deaths from drug overdoses in the U.S. reached a record high in 2014, thanks to the sheer number of prescription painkillers being passed out by cavalier doctors. Another recent study found that the number of people addicted to painkillers and heroin has risen significantly over the past years, but the same number of people are being treated for it.

Perhaps Florida is a lesson for the rest of the country, which is still grappling with ways to curb the epidemic. Just five years ago, Florida was filled with corrupt doctors pushing pills to make fast money, drug addicts lining up outside of sham clinics waiting for their next fix.

“There were lines of drug-seeking customers, not patients, who would snake out the door like some hungry serpent seeking prey,” Assistant U.S. Attorney Simon Gangush, who has prosecuted pill mills, told The Tampa Tribune. “Back then, we saw rogue doctors and crooked pharmacists basically turning people into zombies like the walking dead, and instead of feeding on people, they fed on oxycodone.”

Since then, the number of pain clinics in Florida dropped to less than half of what there were before. But there’s still work to do in other states that are pill mill havens.

“This study underscores that the sharp rise in prescription opioid overdose deaths has become a public health epidemic that is driven, in part, by major criminal enterprises,” Daniel Webster, a professor of health policy and management at Johns Hopkins, said in the press release. “Our new study demonstrates that the right laws and strategic enforcement can prevent addiction and save many lives.”

Source: Kennedy-Hendricks A, Richey M, McGinty E, Stuart E, Barry C, Webster D. Opioid Overdose Deaths and Florida’s Crackdown on Pill Mills. American Journal of Public Health. 2015.