Corrected while to for