 
 (defn add-urnnbn-to-mods
   [[mods workdir]]
-  (let [urnnbn (slurp (io/file workdir "payload" "urnnbn"))]
+  (let [urnnbn (slurp (io/file workdir "request" "payload" "urnnbn"))]
     [(map (fn [one-mods] (m/with-urnnbn-identifier one-mods urnnbn)) mods) workdir]))
 
 (defn mods->oai_dcs
   [[mods workdir]]
   [(map m/mods->oai_dc mods) workdir])
 
-;; (defn save-img-files
-;;   [[mods_files workdir]]
-;;   (let [uuid (slurp (io/file workdir "uuid"))
-;;         slurp-img-full (comp slurp (partial io/file workdir "img_full"))
-;;         slurp-img-preview (comp slurp (partial io/file workdir "img_preview"))
-;;         ]
-;;     (.mkdir (io/file workdir uuid))
-;;     (.mkdir (io/file workdir uuid "img"))
-;;     (fs/copy (io/file workdir "img_full" (slurp-img-full "filename")) 
-;;              (io/file workdir uuid "img" (slurp-img-full "filename")))
-;;     (fs/copy (io/file workdir "img_preview" (slurp-img-preview "filename")) 
-;;              (io/file workdir uuid "img" (slurp-img-preview "filename")))
-;;     [{:type :img_full
-;;       :mimetype (slurp-img-full "mimetype")
-;;       :filename (slurp-img-full "filename")
-;;       }
-;;      {:type :img_preview
-;;       :mimetype (slurp-img-preview "mimetype")
-;;       :filename (slurp-img-preview "filename")
-;;       } 
-;;      workdir]))
-
-
 (defn make-package-with-foxml
   [[mods mods-workdir] [oai_dcs oai-workdir] workdir]
   {:pre [(= workdir mods-workdir oai-workdir)]}
-  (let [payload-dir (io/file workdir "payload")
+  (let [payload-dir (io/file workdir "request" "payload")
         uuid (slurp (io/file payload-dir "uuid"))
         result-dir (io/file workdir uuid)
         full-file {:mimetype (slurp (io/file payload-dir "original" "mimetype"))

  (.mkdir (io/file workdir "marcxml2mods" "request"))

  [{:uuid (.toString workdir)}
   {:marc_xml (slurp (io/file workdir "payload" "oai_marc.xml"))
    :uuid (slurp (io/file workdir "payload" "uuid"))
    }])

(defn save-marcxml2mods-response

      (with-open [out (io/output-stream (io/file out-dir (-> first-page :filename)))]
        (.write out (Base64/decodeBase64 (-> first-page :b64_data)))))
    
    (let [out-dir (io/file workdir "request" "payload" "original")
          original (-> msg :original)
          ]
      (.mkdir out-dir)
