Use WaitUntil instead of inline sleep