Some for loops can be simplified to while loops - this makes them more concise.