D rewrite