Order of rewrite rules