   ;; write the names of all directories and files into the buffer
   (while files-and-dirs
     (setq cur-entry (car files-and-dirs))
-;    (message (cdr (assoc 'dir cur-entry)))
     (setq cur-dirname (cdr (assoc 'dir cur-entry)))
     (setq cur-files (cdr (assoc 'file cur-entry)))
-    
+
+    ; determine the last subdirectory of the current entry
+    (setq cur-lastpath (car (last (split-string cur-dirname "/"))))
+
     ; format the text
     (insert cur-dirname)
     (insert "\n")

  (interactive)
  (setq fileinfo-to-insert (current-menu-entry))
  (setq filename (car fileinfo-to-insert))
  (setq comment (car (cdr fileinfo-to-insert)))
  (switch-to-buffer (other-buffer))
  (insert-org-image filename comment))


(defun current-menu-entry ()



(defun get-file-at-line (line)
; (message file-table)
  (cdr (assoc line file-table)))

(provide 'project)
