rewrite document.