       (do
         (info "working on an unresolved dependency hierarchy")
         (#'ldeps/walk-deps expanded-tree #'ldeps/print-dep)
-        (doall (map (partial unzip&update-artifact! name version pprefix skip-repackage-java-classes srcdeps-relative srcdeps expanded-tree prefix-exclusions project-source-dirs []) (keys expanded-tree))))
+        (walk-dep-tree
+         expanded-tree
+         unzip-artifact!
+         update-artifact!
+         {:src-path        srcdeps
+          :parent-clj-dirs []}
+         {:pname                       name
+          :pversion                    version
+          :pprefix                     pprefix
+          :skip-repackage-java-classes skip-repackage-java-classes
+          :srcdeps                     srcdeps-relative
+          :prefix-exclusions           prefix-exclusions
+          :project-source-dirs         project-source-dirs}))
       (do
         (info "working on a resolved dep hierarchy")
         (#'ldeps/walk-deps dep-hierarchy #'ldeps/print-dep)
-        (doall (map (partial unzip&update-artifact! name version pprefix skip-repackage-java-classes srcdeps-relative srcdeps dep-hierarchy prefix-exclusions project-source-dirs []) (keys ordered-hierarchy)))))
+        (walk-dep-tree
+         ordered-hierarchy
+         unzip-artifact!
+         update-artifact!
+         {:src-path        srcdeps
+          :parent-clj-dirs []}
+         {:pname                       name
+          :pversion                    version
+          :pprefix                     pprefix
+          :skip-repackage-java-classes skip-repackage-java-classes
+          :srcdeps                     srcdeps-relative
+          :prefix-exclusions           prefix-exclusions
+          :project-source-dirs         project-source-dirs})))
     (when-not (or skip-repackage-java-classes (empty? (class-files)))
       (class-deps-jar!)
       (apply-jarjar! name version)

    (clojure.walk/postwalk freq-fn dep-hierarchy)
    @frequency))

(defn lookup-opt [opt-key opts]
  (second (drop-while #(not= % opt-key) opts)))

(defn- unzip&update-artifact! [pname pversion pprefix skip-repackage-java-classes srcdeps src-path dep-hierarchy prefix-exclusions project-source-dirs parent-clj-dirs dep]
  (let [art-name         (-> dep first name (str/split #"/") last)
        art-name-cleaned (str/replace art-name #"[\.-_]" "")
        art-version      (str "v" (-> dep second (str/replace "." "v")))
        clj-files        (doall (unzip (-> dep meta :file) srcdeps))
        clj-dirs         (->> (map cljfile->dir clj-files)
                              (remove str/blank?)
                              (map (fn [clj-dir] (str srcdeps "/" clj-dir))) set)
        repl-prefix      (replacement-prefix pprefix src-path art-name-cleaned art-version nil)
        prefixes         (apply dissoc (reduce #(assoc %1 %2 (str (replacement repl-prefix %2 nil))) {} (possible-prefixes clj-files)) prefix-exclusions)
        all-dirs         (->> [(if (str/ends-with? src-path (sym->file-name pprefix))
                                 project-source-dirs

                               (map fs/file clj-dirs)
                               parent-clj-dirs)
                              vec)]
    (info (format "  munge source files of %s artifact."  art-name-cleaned))
    (debug "    proj-source-dirs" project-source-dirs " clj files" clj-files "clj dirs" clj-dirs " path to dep" src-path "parent-clj-dirs: " parent-clj-dirs)
    (debug "   modified namespace prefix: " repl-prefix)
    (debug "    src path: " src-path)
    (debug "    all dirs: " all-dirs)
