Rewrite the sine fly pattern logic