Refactoring. Added coments