Unit test coverage almost 100%; refactorings