Ride-hailing services like Uber have transformed nightlife in car-centric cities, ditching the need for designated drivers and limiting intake of alcohol. But that may soon change, as Uber has filed a patent for technology that can detect if its users are drunk while using the app.

“The system uses a computer model to identify user and trip characteristics indicative of the uncharacteristic user states,” says the patent application. “The system uses the data about past trips to train a computer model to predict a user state of a user submitting a trip request.”

The spooky new algorithm will take various factors into consideration, including typos made while requesting a ride, the time taken by a user to interact with notifications, their travel speed, and even the angle at which the device is being held. The system will also build up a database of typical behavior for each user which will be used to identify any deviation.

Crimes committed by drivers working for ride-sharing services are widely reported, but incidents against employees receive far less attention. The new technology will allow Uber to warn its drivers when a passenger is perceived to be drunk, giving them the opportunity to deny the request for a ride.

The system will also help match intoxicated riders with drivers that have received relevant training and could potentially be used to modify pickup or drop-off locations based on safety concerns.

Just how well the new algorithm will work remains to be seen. If implemented as planned, users may soon be too drunk to drive and too drunk to Uber.