added ability to handle multiple files per document; rewrote the file type num function.