can we replace this with a conditional wait?