reverted the for loops