[N1] - Second major routine converted to switch/case state machine.