Started to work on the state machine