Introduced tests. Refactoring