Starting to work more on the state machine