set up the state machine pt 1