If I hadn’t worked in a fruit fly genetics lab in college, I might still be a scientist today. Our lab studied how sperm compete inside the female fruit fly’s reproductive tract, which was cool, but the actual work was monotonous. I would get nosebleeds as I etherized the little buggers so they’d lie still. Then, squinting, we’d use a paintbrush to delicately sort them into groups of males and females based on the shade and shape of their tiny, tiny abdomens. From there, we sorted them by eye color—red, orange, or white. After a big experiment we’d have to do this for hours at a time. It was a headache, literally.

Now, thankfully, a robot can capture these flies and visually analyze them so scientists don’t have to.

The machine uses a flash of infrared light to spot the flies. The light, invisible to the fly, reflects off its body, revealing its location. Then, like an alien spaceship, a needle-sized tube descends toward the fly and uses air to suction the insect up.

After this “gentle picking,” the machine can tip or rotate the fly around for visual inspection, and deliver it somewhere else. Machine vision can measure the fly and determine whether it’s male or female; it can also sort them by strain and perform brain imaging and microsurgery. Then once the necessary data is gathered, it releases the fly, unharmed.

The setup cost the researchers around $5,000 to build. It can analyze 1,000 flies in 10 hours (much faster than an undergrad), and because the flies don’t need to be conked out for the analysis, scientists can use it to study the flies while they’re awake. That’s helpful, for example, if you want to study the fly’s neural activity as it moves.

By making data collection faster and easier, the machine could speed up advances in genetics, aging, cancer, and other areas of health research.

The video below shows the machine in action. After a flash of light, the machine picks up a fly, brings it over to a camera that detects the fly’s head, then drops it in a tube that holds onto its head for further study.