simplify loop
Merge pull request #6622 from iquaba/simple_loop

simplify loop