When Carlos Mastrangelo hit his early 50s, he started suffering from a vision problem many people have as they age: he couldn’t focus up close anymore and so, his eye doctor told him, he needed to wear glasses whenever he wanted to read a book.

“I kept asking myself why I am being treated with technology developed by Benjamin Franklin,” Mastrangelo wrote in an email to The Verge. “I don't live in the 18th century.”

But the most annoying thing was that he had to take those glasses on and off almost constantly throughout the day. If he was driving, he couldn’t have them on while looking at the road, but without them he couldn’t see the GPS screen or the dash panel.

“I don’t live in the 18th century.”

So Mastrangelo, who’s a professor of electrical and computer engineering at the University of Utah, decided to solve the problem for himself. He created a pair of smart glasses.

These glasses, which were displayed at CES last month, are made of liquid lenses that automatically focus on whatever the wearer is looking at — far away or up close. This way, people with Mastrangelo’s eye condition, called presbyopia, wouldn’t have to put them on and take them off all the time.

This is how the smart glasses work: a distance sensor in the bridge of the glasses uses infrared light to calculate the distance between the glasses and an object. The sensor then tells “actuators” to reshape how the liquid lenses are curved.

The curvature of a lens controls the focal length. This happens naturally in the eyes as well. Normally when you’re young, the lenses of your eyes are flexible, so they change their curvature easily, allowing you to focus on objects far away and up close. (As you get old, your eye lens becomes more rigid and that’s why it becomes hard to read a book, for example.)

Changing how the liquid lenses are curved allows the smart glasses to focus on whatever the wearer is looking at. It takes about 14 milliseconds for the glasses to change focus, and the rechargeable battery in the frames lasts more than 24 hours, Mastrangelo says.

“The response was phenomenal,” Mastrangelo says of CES. Research on the smart glasses was published this week in the journal Optics Express.

The current design is bulky, but Mastrangelo and doctoral student Nazmul Hasan are already working “on much lighter, slimmer and stylish and more capable versions of this set.” Those second-generation smart glasses will include eye tracking and a depth camera, so that the lenses can more accurately figure out what the wearer is looking at. All those added features will use more energy, so they must also create a more powerful battery that’s also small enough to fit in a stylish pair of glasses people will actually want to wear.

Mastrangelo thinks the smart glasses will become available in two or three years, and will cost around $500 to $1,000. Despite the high price, Mastrangelo swears by his invention.

“Our smart autofocus eyeglasses can compensate for the focusing loss of the eye so most aging individuals afflicted with far or near sightedness wearing these sets can see sharp images all the time,” he says. “They are worth the price.”