minor format edits & tighten loop