Refactoring. New tests