State diagram and clean of the app-fsm state machine