         [ring.util.codec :only [url-encode url-decode]])
   (:import java.net.URL))
 
-(defonce circles (ref {}))
+(defonce anchor-circle (ref {}))
 
 ;;;; http://clojure-liberator.github.io/liberator/tutorial/all-together.html
 ;; convert the body to a reader. Useful for testing in the repl

  :post! #(create-circle %)
  :new? true
  :handle-ok #(map (fn [id] (str (build-entry-url (get % :request) id)))
                   (keys @circles))
  :handle-created #(when (::create-failed %) 
                     (ring-response {:status 400 
                                     :body (::create-failed %)}))

  (let [{:keys [name lead-link-name lead-link-email]} (::json-data context)]
    (try
      (dosync
        (alter anchor-circle assoc name 
               (g/anchor-circle name lead-link-name lead-link-email)))
      {::circle-data (get @anchor-circle name) ::url-encoded-id (url-encode name)}
      (catch IllegalArgumentException e
        ;(.printStackTrace e)
        {::create-failed (format "IllegalArgumentException: %s" (.getMessage e))}))))
