Added a 1 second sleep to the while loop