One of the big reasons driverless-car tech hasn’t gone mainstream yet is because it can’t deal with snow and rain very well. Some of the sensors can become untrustworthy in wet weather, including the cameras that pick out road dividers, and laser radar, or LiDAR, which can wrongly interpret snowflakes as obstructions on the road.

But Ford, which has been testing its driverless cars in Michigan’s snow since January, says its autos can now “see” raindrops and snowflakes for what they really are, thanks to an algorithm developed with the University of Michigan. Here’s an advertisement featuring video of that testing:

Here’s how it works: Ford’s autonomous cars rely on LiDAR sensors that emit short bursts of lasers as they drive along. The car pieces together these laser bursts to create a high-resolution 3D map of the environment. The new algorithm allows the car to analyze those laser bursts and their subsequent echoes to figure out whether they’re hitting raindrops or snowflakes.

When a laser goes through the rain or snow, part of it will hit a raindrop or snowflake, and the other part will likely be diverted towards the ground. The algorithm, by listening to the echoes from the diverted lasers, builds up a picture of the “ground plane” as a result, said Jim McBride, technical leader for autonomous vehicles at Ford.

“If you record not just the first thing your laser hits, but subsequent things, including the last thing, you can reconstruct a whole ground plane behind what you’re seeing, and you can infer that a snowflake is a snowflake,” he told Quartz.

Additionally, the algorithm checks for the persistence of a particular obstacle. A laser beam is unlikely to hit a raindrop twice, for example, allowing the algorithm to rule it out as an obstacle, McBride told Quartz.

McBride said Ford’s cars have driven through several millimeters of rain on the road. He wouldn’t say what depth of snow the cars have successfully navigated. Ford’s rivals in the driverless car race are also working hard on winter driving. Google is reportedly testing cars in Washington state, while Volvo is doing so in Sweden.

But as autonomous cars become capable of navigating more visually challenging weather conditions, some caution is necessary, McBride points out.

“Let’s say I could drive at 80 miles per hour in the fog because I had some magical sensor that could see through it,” he told Quartz. “That doesn’t mean the other cars on the road can see through it … You have to mix in with the rest of the world. If you engage a system like that, you become an invisible vehicle to the rest of the people.”

Read this next: Ford CEO Mark Fields on self-driving cars, buying things from Amazon while we drive, and Mustangs