Added proper error handling to driver