major refactoring, 100% test coverage