started rewriting sequence detection