Fixed iterator to actually follow control flow