changed for loop to single iteration