Tune while loop with a sleep 0.01 sec