Circular sequence detection