Refactorings and better test coverage
Refactoring