Minor refinements to for loops