Refactoring. Tests