minor edits in for-loop