Rewrite mostly complete