improve client fsm structure