   `(dosync
       (ref-set slag.web/routes (merge @slag.web/routes {~(keyword (clojure.string/replace route #"(/:)([\w]*)" "/$2")) (compojure.core/ANY (str "/" ~route) ~args (fn [request#] (liberator.core/run-resource request# ~@kvs)))}))))
 
+(map? (merge {} {:sd true}))
+
+(defn fname
+  [f]
+  (subs (first (re-find #"(\$)[A-Za-z0-9]*" (.toString f))) 1))
+
+(defn ensure-argument
+  [priority checker given & expected]
+  (let [priors ["first" "second" "third" "forth" "fifth" "sixth"]]
+    (if (not (checker given))
+      (throw (IllegalArgumentException. (str "Please, pass " (or (first expected) (fname checker)) " as " (get priors priority) " argument"))))))
+
 (defmacro defres
   [& form]
   (let [[root common route args res & nxt] (vec form)
-        factory `(res-handler ~(str root route) ~args ~(merge common res))]
+        factory `(res-handler ~(str root route) ~args (merge ~common ~res))]
+    (ensure-argument 1 string? root)
     (cond (nil? nxt) factory
           :else `(do
                    (defres ~root ~common ~@nxt)


           "" [] {

                  :exists? (=> r :query-params "a" a
                             (= "asd" a))

                  :handle-ok (str "SERVERS LIST")
                  }

           )

        vars (vec (keep-indexed #(if (odd? %1) %2) bindings))
        values (vec (keep-indexed #(if (even? %1) %2) bindings))]
    (if (and (> (count values) 0) (= (count values) (count vars)))
      `(fn [$#] (apply (fn [~req ~@vars] ~(last kvs)) (apply conj [$#] (vec (map #(get-in $# %) ~values)))))
      `(fn [$#] (apply (fn [~req] ~(last kvs)) [$#]))
      )
    ))

(def common-options {
              :available-media-types ["text/plain"]
              :allowed-methods [:get :put :post]
           })

(defres "servers"

          (merge common-options {:available-media-types ["text/plain" "text/html"]})

           "/:id" [id] {
                        :handle-ok (=> r
