-state machine set up