refactor common code into driver

Authored by bgupta on Jul 27 2016, 5:57 PM.