Function clearDocuments