only dereference iterator once in the loop