Reworked the driver handler code