Refactor and got test coverage going.