It is just a state machine. You feed it your current order state and your intended order state. It works out the most efficient way to get from current to intended.