   [param-map url]
   (if (string/blank? url)
     "" 
-    (let [act-tmplt-keys  (select-keys param-map template-keys)
-          split-url (string/split (string/replace url "https://" "") #"/") 
-          ]
+    (let [act-tmplt-keys (select-keys param-map template-keys)
+          split-url (string/split (string/replace url "https://" "") #"/")]
       (build-new-url "" split-url act-tmplt-keys))))
 
 (defn comma-separate
   "If v is a sequence, convert to a comma separated string." 
-  [k v]
+  [v]
   (if (or (seq? v) (vector? v))
-    [k (string/join "," v)]
-    [k v]))
+    (string/join "," v)
+    v))
+
+(defn- map-vals
+  "Applies f to each value in m."
+  [f m]
+  (zipmap (keys m)
+          (map f (vals m))))
 
 (defn convert-values
   "Convert values in query-params to match spotifys api."
   [m]
-  (into {} (for [[k v] m] (comma-separate k v))))
+  (map-vals comma-separate m))
 
 (defn remove-path-keys
   "Remove keys that are used in modifying the path."

(ns clj-spotify.core
  (:require [clj-http.client :as client]
            [clojure.data.json :as json]
            [clojure.string :as string]
            )
  )

(def template-keys [:id :category_id :owner_id :playlist_id :user_id])


  (apply dissoc m template-keys))

(defn modify-form-params
  "Do necessary conversion of form parameters."
  [m]
  (-> m
      remove-path-keys
      convert-values))

(defn select-params-type
  "Return either :query-params or :form-params key depending on value of verb"
  [verb]
  (if
    (or (= verb client/put) (= verb client/post))
    :form-params
    :query-params))

(defn spotify-api-call
  "Returns a function that takes a map m and an optional oauth-token t as arguments."
