insanely huge state machine controller...