Refactorings. Added new test class.