rewrite by document