Fixed each loop to use each_slice.