changed the for loop