adding some unit tests, removing the broken test, and refactoring a bit to make things more testable/usable