Refactor frag into fsm cursor