Brain implants are no longer confined to science fiction movies. Scientists have been working to develop chips to improve memory after neurological damage, repair lost vision and even control advanced prosthetics. Advances like these may be available in just a few years.

But they’re not here yet, and there’s at least one reason why — it’s not easy for implants to specifically target the neurons that require treatment, and as a result, some implants risk damaging the brain. Now a new type of implant, a thin, magnetic coil just a fraction of an inch long, has the potential to be one of the most promising designs yet, for medical purposes and beyond.

Scientists have long known that magnetic energy can stimulate the brain to treat conditions such as depression, anxiety and bipolar disorder with far more precision than the electrical currents used in existing implant designs. But they hadn’t been able to make the implants small enough while still generating a powerful-enough magnetic field. For the moment, when mental health professionals want to use magnetic fields to treat patients, they have to apply it to the outside of the head using techniques like transcranial magnetic stimulation (TMS) or magnetic seizure therapy.

This device could produce a big enough magnetic field while still producing fewer side effects when implanted in the brain than standard electrodes, according to a study published Friday in Science Advances. Unlike electrodes, the coil wouldn’t risk shocking the surrounding tissue should its protective layer get worn down, and when wrapped in biocompatible material, it causes less damage when it’s inserted in the brain.

After computing the right dimensions, the researchers tested their device to make sure it stimulated neurons in the right way, first on slices of mouse brains on petri dishes in the lab, then by implanting them directly into the brains of the mice. They positioned the devices so that, when connected with wires to bring electricity to the devices, they would stimulate the neurons that move the mice’s whiskers. The implants worked just as the researchers had hoped — when they activated the devices, the mice flicked their whiskers.

The researchers have a few more questions to answer before the devices can be tested in humans, such as the ideal frequency and length of the magnetic pulses. But if these devices do make their way into human brains, they could be used for more than treating neurological conditions.

Connecting computers to our brains through implants could be useful in fields as diverse as security, games, education and marketing. When it comes to specific brain signatures or transmitting thoughts digitally, magnetic data would be more useful than that from electrodes because the technology is much more precise, down to the level of just a few neurons, instead of entire regions of the brain.

But humans would take some convincing before allowing devices to be implanted in their brains, especially if it were for non-medical purposes — a Pew survey from earlier this year found that most people would be concerned, rather than enthusiastic, about neurological implants that weren’t intended to treat a condition. If the magnetic device is as effective and reliable as the researchers hope, maybe it will be enough to change their minds.