Adjusted the loop