state machine work, better dialog handling