adjusted for loop