added simple control state machine