Agent now works with two-state machine

Agent now fully works with our hard-coded two-state machine.
It will produce the correct mapping every time.