Added extra error checking to driver