Replaced "while" on "for"