changing the termination condtion of the while loop
updating logs