restructure of state machine