started work on the state machine