In 2014, I walked into a dispensary in Boulder and emerged with something truly surreal: a receipt. For weed. Two years earlier, Colorado had voted to legalize recreational marijuana—reflecting a seismic shift in American attitudes toward the drug. In just two generations, the portion of the population that supports legalization went from 12 percent to 58 percent. Along the way, we’ve seen emerging marijuana markets, new technologies, and the normalization of experiences that were once taboo.

At the same time, though, Americans are succumbing to the dangers of other drugs in ever greater numbers. Substance-use disorders now affect more than 21 million Americans. Drug overdose—especially from heroin and other opiates—is the leading cause of accidental death in the U.S. And nearly a third of all vehicle fatalities are alcohol-related.

On the one hand, we want to feel good. On the other, we need to do more to protect ourselves and our loved ones. Scientists and entrepreneurs are working on new products and technologies that promise to make drugs and alcohol both safer and more satisfying. Here’s what the future of getting high might look like.

1. Marijuana Farming Will Go High-Tech

Marijuana growers have long used old-fashioned breeding techniques—cross two plants, pick the best of their offspring—to make more-potent drugs. But as marijuana farming moves from heavily fortified basements to open fields, we can expect growers to adopt genetic technologies to fine-tune their products—more traits breeders want with fewer undesirable ones tagging along.

Mowgli Holmes, the chief scientific officer of Phylos Bioscience, a start-up that’s studying the cannabis genome, thinks growers will use high-tech breeding to produce less-potent pot—cutting the THC content from 30 percent to something more like 4 percent. “Breeding has been inward-looking, making products for stoners,” he says, comparing currently available varieties to moonshine. “Normal people want to try it but can’t, because they get too high. Legalization should lead to options more like wine and beer.”

NatureArtForest / Shutterstock; Wikimedia; Associated Press; Yamabikay / Shutterstock

But high-tech breeding could also produce a more far-out high. In the science-fiction novel Do Androids Dream of Electric Sheep?, Philip K. Dick wrote about the mood organ, a device that allows people to choose how they want to feel. The pot of the future could work similarly, Holmes says. Already, many sellers market their product by the mood it’s said to produce. In analyzing the cannabis genome, Holmes hopes to find markers in certain strains of weed that make people feel calm, or creative, or even hungry.

2. Sobriety May Come in a Pill

Scientists have been searching for a very long time for compounds that can reduce or reverse the effects of alcohol, says Aaron White, the senior scientific adviser at the National Institute on Alcohol Abuse and Alcoholism. In the 1990s, when he was in graduate school, everyone seemed to think Ro15-4513 might be that drug. Images circulated, he says, of a drunk rat lying on its back with its feet in the air next to a healthy-looking rat that had taken Ro15-4513. Unfortunately, it turned out that the drug also caused seizures.

Today, one promising candidate is dihydromyricetin, or DHM, a compound that can be derived from the extract of a raisin tree native to Asia. The Chinese have used the extract to treat hangovers for hundreds of years, and research on rats suggests that it can mitigate some of alcohol’s effects on behavior and may even help protect a fetus from exposure to alcohol. But we have to be careful, White says. DHM appears to block the effects of alcohol on one type of receptor in the brain. That receptor, gabaA, happens to be associated with some of the really obvious signs of alcohol consumption—sleepiness, loss of balance, memory impairment, and blackouts. But it’s not the only receptor involved in the neuropharmacology of drunkenness. There’s a risk, White says, that DHM could make people feel less drunk without actually making them sober, with potentially disastrous results if they were to get behind the wheel or otherwise misjudge their impairment.

3. Skirting the Law Will Be Easier

The Web has been intertwined with drug use since its beginning, says Mike Power, the author of Drugs 2.0: The Web Revolution That’s Changing How the World Gets High. In fact, the first thing ever sold online, in 1972, was a bag of weed. Today, the Dark Web—the shadowy part of the Internet that doesn’t show up in search engines and is known for hosting criminal activity—provides a secret marketplace for drugs. The Internet also enables people to design, produce, and distribute analogs—legal drugs whose chemistry differs only slightly from that of their illegal cousins. As part of his reporting, Power used the Internet to order a legal, bespoke stimulant from a Chinese laboratory, based on the chemistry of a drug called phenmetrazine, which was reportedly beloved by the Beatles.

If the Internet makes drug transactions harder to trace, new technology could conceivably do away with transactions entirely. In May 2015, researchers from UC Berkeley and Canada’s Concordia University announced that they had engineered yeast that mimics part of the biochemical process through which poppies make opiates. Maia Szalavitz, a journalist and the author of Unbroken Brain: A Revolutionary New Way of Understanding Addiction, says that such yeasts could potentially be used to turn household ingredients into morphine. Before too long, people may be able to brew their own opiates at home.

4. Painkillers Will Be Safer

Why would scientists engineer yeast to make opiates? Among other reasons, researchers hope that with a better understanding of opiate creation, they’ll be able to tinker with the chemistry of painkillers and make them less addictive.

Andrew Coop, a professor at the University of Maryland School of Pharmacy, is among those trying to alter the way opiate drugs interact with opioid receptors in the brain. There are several different kinds of these receptors, but all clinically approved opiates target the same kind, called Mu. Inside Mu receptors, the drugs activate two pathways—one that triggers immediate painkilling effects and another that prompts the body to adapt to the drug. That second pathway leads to dependence.

Coop is working on opiates that would target more than one kind of receptor. This approach, called polypharmacology, is based on the idea that different kinds of receptors modulate one another’s effects—so you could get the painkilling effects without the dependence. Another option would be to design drugs that target Mu receptors without triggering the second pathway. Finally, researchers are looking at new classes of painkillers that don’t target opioid receptors at all. Unfortunately, many of those efforts have run into pitfalls. For instance, scientists found a promising new painkiller in the secretions of poison dart frogs. But then they discovered that it targets nicotine receptors instead, suggesting it might also be addictive. “Sure, it wouldn’t have the same effects as opioids,” Coop says. “But that’s just opening a whole other can of worms.