Correct rewrite order