Implemented main driver functionality.