reorganized - reimplementing tests, refactoring as I go