Of all the cool gadgets in science fiction, one of the niftiest is the memory-eraser stick that Will Smith and Tommy Lee Jones wield in the movie Men in Black.

Now such a device is a step closer to reality. Researchers at UC Davis have successfully erased specific memories from the brains of mice…by using beams of light. Yes—light—just like the “Neuralyzer” tool in the popular sci-fi comedy franchise.

Neuroscientists have long believed that memory retrieval involves two parts of the brain, the cerebral cortex and the hippocampus. “The theory is that learning involves processing in the cortex, and the hippocampus reproduces this pattern of activity during retrieval, allowing you to re-experience the event,” said Brian Wiltgen, one of the lead researchers, in a release for the study.

Wiltgen and his colleagues used genetically modified mice (whose nerve cells glow green when activated) to test the theory that specific nerve cells in the brain could be switched off by light. The mice were trained by receiving a mild electric shock when placed in a cage. Thereafter, each time they were put in the cage, they would freeze in fear, instead of roaming around as they’d normally do.

Then came the fun part. The omnipotent researchers switched off the mice’s memories of being shocked by beaming light into their brains using a fiber optic cable. Since the mice were genetically modified, the researchers could isolate the exact cells responsible for those memories, and direct the light to those cells only—without disrupting any other cells in the hippocampus. When the mice were placed back in the cage, they would no longer freeze in fear, apparently because they had no memory of ever being shocked.

Of course, this experiment has yet to be done on humans (at least as far as we know). And for now, the light needs to be connected directly into the brain via a cable, rather than as a flash of light detected by the eyes and then converted into something the brain can read. But it’s one step closer to making science fiction a science fact—which is either totally awesome or unthinkably frightening, depending on whom you ask. We’re going with the former.