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

       (point-max))))


(defun insert-org-image (filename  comment)
  (insert (concat "#+CAPTION: " comment "\n"))
  (insert (concat "[[" filename "]]\n")))



    ;; add the files to the current dir
    (while cur-files
      (setq cur-file (car cur-files))

      (when (not (string-match ".*_comment.txt$" cur-file))
	;; read the comment from the corresponding file
