refactored driver to be a higher-order function that accepts a callback