_wait_for_transition refactored