replaced taskDelay()