Completed re-factoring and passing of all tests.