Major refactoring.  Re-started writing tests.  All tests should pass currently but many tests are missing.