added a sleep line to the while loop to free up resources