Refactor cpp driver functions.