more minor edits to loops