Some refactoring
Refactoring. Implemented 'loop'