Stylistic tweaks to for, foreach and if