New technology developed by MIT’s Computer Science and Artificial Intelligence Laboratory (CSAIL) may help drones dodge collisions as they fly, making things like drone pizza delivery a whole lot more plausible on a large scale.

Whether you’re a human or a drone, moving through a city always involves a certain amount of uncertainty. Will that light turn green as you approach? Will a pedestrian bump into you? Will a pigeon fly in your face? Will there be a sudden road closure for a parade, or a newly installed crane at a construction site? And if there’s one thing that machines tend to be bad at, it’s dealing with uncertainty. For a fast-flying drone, navigating with a static map just won’t cut it in the real world.

So CSAIL researchers created NanoMap, a new system that can model uncertainty, taking into account that, as a drone flies, the conditions around it might change. The technology helps the drone plan for the fact that it probably doesn’t know precisely where it is in relation to everything else in the world. It spends less time calculating the perfect route around an obstacle, relying instead on a more general idea of where things are and how to avoid them, allowing it to process and avoid potential collisions more quickly.

It features depth sensors that constantly measure the distance between the drone and the objects around it, creating a kind of image for the machine of where it has been and where it is going. “It’s kind of like saving all of the images you’ve seen of the world as a big tape in your head,” MIT researcher Pete Florence explains in a press release. “For the drone to plan motions, it essentially goes back into time to think individually of all the different places that it was in.”

In testing, the NanoMap system allowed small drones to fly through forests and warehouses at 20 miles per hour while avoiding potential collisions with trees and other obstacles.

The project was funded in part by the Department of Defense’s DARPA, so it could be used as part of military missions, but it would also be helpful for any kind of drone-based delivery—whether it’s ferrying relief supplies to combat zones or your latest Amazon Prime package.