pattern rewrites