first design of a state machine