Updates and setting up the document.