Updates main document.