For children in hospitals, needles can be an anxiety-inducing, painful experience. Now, scientists are finding that virtual reality can be used to reduce the pain.

Researchers at the Children’s Hospital Los Angeles tried “VR analgesia” — a technical term for pain control — on a group of patients ranging from 10 to 21 years old. Some of the patients received what researchers considered standard care, which included a minor anesthetic and a movie to distract oneself while getting blood drawn.

Other patients, however, were given a little more room for fun. Researchers set them up with a VR headset and game, and they found that these patients experienced less acute pain, anxiety and distress during the blood draw.

“VR, especially immersive VR, draws heavily on the limited cognitive resource of attention by drawing the user’s attention away from the hospital environment and the medical procedures and into the virtual world,” Jeffrey Gold, director of the Pediatric Pain Management Clinic at Children’s Hospital Los Angeles, said in a release.

Other applications are currently up in the air. Certainly, letting someone in on a VR game for the few short minutes it takes to draw blood isn’t a very efficient use of time — but researchers are interested in using VR to reduce pain for longer-term treatments. That idea isn’t new, either.

Since at least 2016, doctors at the University of California San Francisco Benioff Childrens Hospital have also been experimenting with VR gaming as a way to alleviate pain in children with sickle cell disease. Sickle cell disease is a genetic condition that can cause severe bouts of pain when oxygen in the blood is blocked from reaching body tissue.

Though it can’t be treated with VR alone, doctors brought child patients with under-the-sea VR experiences to make their hospitalizations more livable.

“Medications come with a whole host of side effects that are unfavorable and undesirable,” Anne Marsh, a pediatric hetamologist-oncologist at the hospital, said in a video. “VR does not.”