refactoring in the driver