Added state machine prototype