Add fsm implementation