replace repeat with for