I fixed memory leak. I also added a better way to identify file extensions. Files are displayed using a document class.