Refactor the driver for new api.