Added a bool to track if the document has been displayed.