Changed the loop logic