Like a coin machine sorting change according to size, a new lab-on-a-chip can sift cells according to their weight and other properties. Doctors could use it to tease out biological matter from the bloodstream and detect cancer or potentially other ailments.

It would work by passing blood through a small device that’s covered in a series of diagonal microscopic ramps, resembling speed bumps or obstacles in a pinball machine. The ramps could differ in length or height depending on what you’re looking for.

Heavier particles would have a harder time hurdling the ramps, so they’d run down the diagonal pathways instead, eventually fanning out in different directions, according to researchers at Johns Hopkins University.

As the cells are displaced, they become isolated from other, dissimilar cells in the bloodstream.

Along with using gravity, the device could be engineered to sort particles according to other characteristics, like maybe electrical charge or response to a magnetic field. The device could detect small numbers of cells circulating in the bloodstream, so it might help locate cancer cells in the early stages of the disease, said Jorge A. Bernate, a doctoral student who is lead author on a new paper describing the device. Cancer cells could be separated out and targeted for treatment.

This sorting capability would also prove beneficial for other non-medical uses, like drug or chemical detection in security systems, or solar panel manufacturing, according to Hopkins. The paper appears in Physical Review Letters.