converted polling loops to utils.wait(dur)