added TryAndWaitUntil method