   (get request arg))
 
 (defn arg-resolver-middleware
-"Middleware which adds provided argument resolvers to [:rook :default-arg-resolvers] collection."
+  "Middleware which adds provided argument resolvers to [:rook :default-arg-resolvers] collection."
   [handler & arg-resolvers]
   (fn [request]
     (handler (assoc request
-               :rook (merge (or (:rook request) {})
-                      {:default-arg-resolvers (concat (:default-arg-resolvers (:rook request))  arg-resolvers)})))))
+               :rook (merge (:rook request)
+                            {:default-arg-resolvers (concat (:default-arg-resolvers (:rook request)) arg-resolvers)})))))
 
 (defn get-available-paths
-"Scan namespace for available routes - only those that have available function are returned.
-
-Routes are sorted by the line number from metadata - which can be troubling if you have the same namespace in many files.
-
-But then, unless your name is Rich, you're in trouble already... "
+  "Scan namespace for available routes - only those that have available function are returned.
+
+  Routes are sorted by the line number from metadata - which can be troubling if you have the same namespace in many files.
+
+  But then, unless your name is Rich, you're in trouble already... "
   [namespace]
   (->> (ns-paths namespace)
        (map (fn [[[request-method path] function-key]]
               (when-let [fun (ns-function namespace function-key)]
                 [[request-method path] fun])))
        (remove nil?)
-       (sort-by #(or (-> % second meta :line) 0))))    ;sadly, the namespace stores interned values
+       (sort-by #(or (-> % second meta :line) 0)))) ;sadly, the namespace stores interned values
 
 (defn- get-compiled-paths
   [namespace]

         (handler request))))))

(defn rook-handler
"Handler that uses information from :rook entry in request map to invoke proper function
and resolve arguments with arg-resolvers."
  [request]
  (let [rook-data (-> request :rook)
        arg-resolvers (concat (-> rook-data :default-arg-resolvers)
                              (-> rook-data :arg-resolvers))
        fun  (-> rook-data :function)
        args (-> rook-data :metadata :arglists first)
        argument-values (map #(extract-argument-value % request arg-resolvers) args)]
    (when fun
      (apply fun argument-values))))

(defn namespace-handler
"Helper handler, which wraps rook-handler in namespace middleware.

The advanced version also takes a path for compojure.core/context and a list of sub-handlers that
will be invoked BEFORE rook-handler."
  ([namespace]
   (namespace-middleware rook-handler namespace))
  ([path namespace & handlers]
   (compojure/context path []
     (namespace-middleware
      (apply compojure/routes (concat handlers [rook-handler]))
      namespace))))
(defn- scan-namespace-for-doc
  "Build a map of functions in namespace <-> url prefixes."
  [namespace]
  (->> namespace
       ns-paths
       (map #(get-function-meta namespace %))
       (remove nil?)))

(defn build-map-arg-resolver
  "Build an argument resolver which takes a list of keys and constant values and when required argument
