Nit: I think it would be useful to have a comment here explaining exactly why we are waiting on this condition, as well as the ones on lines 41 and 45, as it is not entirely obvious.