waitFor utility