added sleep in the while loop to stop twitching