Initial pattern detection