added a sleep before the loop