Code refactoring
More tests