Updating the main document