More rewrite work