Tasha Hedstrom, age 30, has struggled with opioid addiction for 15 years. Her path to recovery includes taking medications to curb withdrawal symptoms and attending court-mandated group counseling.

But Hedstrom found her peer support group to be ineffective and unhelpful. She felt that others in the group were glorifying drug use, and she disliked “telling her story a million different times,” she told the MIT Technology Review last spring.

Tragically, stories like Hedstrom’s have been echoing across the United States. The Center for Behavioral Health Statistics and Quality estimates that over two million Americans are addicted to prescription painkillers. In 2015 alone, over 20,000 Americans died of an opioid-related overdose.

A new investigation by CBS’s 60 Minutes and the Washington Post blames the crisis largely on political lobbying by pathologically greedy pharmaceutical distributors. Currently, nine states are taking action to sue drug firms for their alleged role in promoting opioid addiction. Cities have also pursued legal actions.

Florida Gubernatorial candidate Gwen Graham, one of the most outspoken champions for suing pharmaceutical companies, compares opioid addiction to tobacco use. “We need to have that same approach with pharmaceutical companies and hold them accountable for addiction crisis that we see,” she said recently.

It’s true that suing pharmaceutical companies for promoting opioids and painkillers will likely deter opioid production and prescription. Sound drug policies, however, must also take account of another truth: When used correctly, opioids have tremendous medical benefits. This is no trivial matter. Pain management is a complex medical issuing facing 126.1 million US adults, including 24.3 million who suffer daily, according to a 2015 study published in the Journal of Pain. For many of these patients, opioids provide much-needed relief.

Denying them a consistent and effective treatment option leaves one less alternative to cope with debilitating pain. Patients who lose their prescriptions usually turn to illicit alternatives, including heroin, to reduce pain or fight withdrawal symptoms. Advocates of aggressive state prosecutions are therefore in denial about the suffering their policies would cause.

Moreover, forty-nine states already have laws dictating how doctors should prescribe controlled substances and document their use. Some of these laws are specifically for opioids, but the laws don’t seem to be working. According to the Health Open Access data, the same nine states suing pharmaceutical companies also have the strictest prescription-monitoring laws. Not only are those states making it harder for patients to get pain medication, they’re also not preventing overdoses.

But what’s the alternative?

Where state governments have not deterred opioid abuse, technology has. Innovative companies are finding new ways to combat prescription drug abuse. By working with physicians, patients and healthcare providers, medical technology entrepreneurs are providing helpful alternatives to costly and ineffective government programs.

RxAssurance, a Denver-based tech startup, created OpiSafe, a program that helps physicians who prescribe opioids closely monitor the dosages taken by their patients. Although state prescription drug monitoring programs collect information similar to what OpiSafe reports, doctors say it meets their needs better.

OpiSafe also has a mobile app that allows patients to monitor how much medication they are taking and how much pain they are feeling. As of February, over 5,000 patients use OpiSafe in forty-one states.

Technological progress is also helping doctors to prescribe opioids more safely. A recent study, published in the journal Health Services Research and Managerial Epidemiology, found that technology developed by Proove Biosciences accurately predicts whether patients face a risk of opioid addiction. In a press releaselast June, Proove CEO Brian Meshkin said, “We can reduce pain and opioid abuse at the same time.”

While abuse prevention is critical, another important question is whether or not medical innovations can assist addicts in recovery, such as Hedstrom. Fortunately, the answer is yes.

Chicago-based Triggr Health has developed a mobile app that provides addicts with access to personalized care and helps them set goals toward recovery. The app also uses volunteered information to predict when the addict is most likely to relapse.

Hedstrom is one of many to benefit from Triggr Health’s app. Unable to find support in group-counseling, Hedstrom now feels she is “on a friend basis” with the recovery coaches she texts back and forth with via the app. With over 90 percent of drug abusers never seeking treatment, Triggr Health gives Americans like Hedstrom hope.

This is more than one can say about many government efforts to curb the opioid problem. Comparing that overall record of floundering performance with the solutions offered by new medical technologies, it might be time for governments to step aside. At least technology has fewer side effects.