tidy state machine into sections