Use for loops instead of while.