Changes in replanning logic and Swap state machine change.