Memories are a complex combination of objective information—the color of a car, the size of a building—and less tangible emotional feelings, like fear, anxiety, joy, or satisfaction. But to scientists, memories are nothing more than a series of chemical and physical changes, the firing of a nerve here, which sends electrochemical impulses to another nerve there, which together encode everything that we associate with a memory.

But exactly what do those changes look like? And is it possible to override them? In a milestone paper published in the journal Nature, scientists may have provided some answers, explaining how emotional baggage gets attached to memories, and how that can be manipulated to quite literally turn bad memories good. In separate work appearing in the journal PLOS ONE, researchers say that a commonly used anesthetic gas, xenon, if administered at exactly the right moment, can also strip the painful and negative feelings associated with a traumatic memory, essentially neutralizing it.

The findings from both groups come from mouse studies, but the two teams are confident that the results will further efforts to understand and find new ways to treat depression and post traumatic stress disorder in people.

In the Nature study, Susumu Tonegawa and his team showed for the first time exactly where in the brain both positive and negative memories are created, and how these emotional layers can be switched around. They exploited a cutting-edge technique they developed called optogenetics to track an emotional memory as it’s made and also manipulated in the brains of mice. They studied both positive experiences—male mice were allowed to spend about an hour with female mice—and negative experiences—the mice were given mild foot shocks.

MORE: 5 Secrets to Improve Learning and Memory

First, the researchers administered a protein, called channelrhodopsin, into mice nerve cells that were activated during and immediately after those experiences (the positive and the negative). The protein reacts to a specific blue wavelength of laser light—and the scientists discovered that when that light was administered to the the part of the mouse’s nerve cells that fired up after those good or bad experiences, the emotion associated with the memory was relived as though it were happening all over again, even absent the stimulus that created it in the first place.

“Optogenetics for the first time allowed us to pin down the cells in the brain that literally carry the information for a specific memory,” says Tonegawa.

The real revelation came when the scientists tested how malleable the connection between the shock and the memory was. They allowed the shocked mice to spend time with females while their brains were hit with the blue light—which triggered their fear of the shock even though they didn’t get one. After 12 minutes of the laser exposure, the mice relaxed. But it wasn’t that they had replaced their fear with more pleasant feelings. Images of their brains showed that new circuits, presumably the ones associated with more positive feelings of being with females, had sprouted between the emotional regions of the brain and the memory center. Likewise, the mice that had had the pleasurable experience with their female counterparts were given the shock while exposed to the blue light, and now showed more fear and anxiety. The original emotional associations were not eliminated and replaced. Instead, says Tonegawa, the positive and negative circuits compete with each other, and whichever is dominant becomes the prevailing emotion linked to a memory.

MORE: This Is the Brain Circuit That Makes You Shy

That could explain how some psychotherapy currently works. To help depressed patients address their feelings, some therapists will revisit negative or emotionally painful experiences. Because memories are not recalled and returned in exactly the same way like a recording, any new information attached to that memory—such as more neutral or positive perspectives about the episode—can help to diffuse its negative impact. Tonegawa’s work in animals suggests that it’s possible to make that psychotherapy technique even more effective if therapists can help patients to focus on more positive feelings while reconsolidating painful memories.

That’s what another group, at McLean Hospital, is hoping to do with a much more simplistic strategy. Edward Meloni, an assistant professor of psychiatry at Harvard Medical School and Marc Kaufman, director of the McLean Hospital Translational Imaging Laboratory, found that the gas xenon, which is used in anesthesia (primarily in Europe), can neutralize the fear associated with a traumatic memory. Exposing mice that had experienced foot shocks to the gas dramatically reduced their fear behaviors – such as freezing up and avoiding areas associated with the painful shock – for up to two weeks. That’s because xenon preferentially targets certain receptors, called NMDA, on brain nerves that are concentrated in learning and memory regions. So when a traumatic memory is activated, those neurons involved in recalling that memory are prime targets for xenon, which blocks the cells from making their usual connections to the emotional hub in the brain known as the amygdala. “My speculation is that xenon lessens the impact of the emotional component, the real emotional pain associated with a traumatic experience,” says Meloni.

MORE: Memories Can Now Be Created — And Erased — in a Lab

It’s not clear yet whether the gas will have similar effects on long-standing traumatic memories such as those involved in PTSD, but Kaufman and Meloni plan to set up a human trial as soon as possible. Ideally, says Meloni, if xenon proves to be effective and safe for reshaping memories, patients who experience debilitating nightmares would be able to give themselves a squirt of xenon just as they would use an asthma inhaler. Since the gas dissipates quickly, so far there doesn’t seem to be a reason to worry about other potentially harmful effects on the brain.

And what about situations that don’t quite reach the level of PTSD, but are traumatic nonetheless, such as the death of a loved one or a bad breakup? “In general I think those painful experiences are probably not going to be impacted by xenon because there really isn’t a specific memory that is reactivated, like a flashbulb moment of trauma,” he says. “It’s more a global heartbreak.”

Because xenon isn’t specific to blocking the negative connections to the brain’s emotional nexus, Kaufman says it’s possible the gas could also be helpful in reducing the highs and the reward sensation associated with addiction. More studies will need to show that xenon could play a role in those situations as well, but both he and Meloni are optimistic. “We’ve got a good start in animals, and as we work through the ladder in getting it to people, I’m hopeful,” says Meloni.

Contact us at letters@time.com.