Initial version for state machine code