Added some unit testing and coverage reporting so refactoring can start.