Rewrite almost done