worked on state machine