Minor refactoring and added tests.  Tests are now 100% complete.