edited the loop