Implement FSM support (initial commit)