Replace `for x in range` with `array.each`