Refactored and added another wait helper.