Further refinements to debugging output and correction of error when wait_for_active code was moved to separate method