change loop method
refactoring end