Trim unnecessary part of document.