             #(conj % {new-id {:title thread-name}}))))
       (alter chat-messages
         #(conj % {new-id []}))))
-  {:status 200
-   :headers {"Content-Type" "application/edn"}
-   :body (pr-str (get @chat-threads channel-id))})
+  (edn-response (get @chat-threads channel-id)))
 
 (defn new-chat-thread-handler [request]
   (let [body (read-string (slurp (:body request)))]

  (let [id (atom 0x00B)]
    (fn [] (swap! id #(inc %)))))

(defn channels-handler [request]
  {:status 200
   :headers {"Content-Type" "application/edn"}
   :body (pr-str @channels)})

(defn new-channel [channel-name]
  (let [new-id (next-id)]

(defn chat-threads-handler [request]
  (let [params (:route-params request)
        channel-id (read-string (:channel-id params))]
    (edn-response (get @chat-threads channel-id))))

(defn chat-messages-handler [request]
  (let [params (:route-params request)
        thread-id (read-string (:thread-id params))]
    (edn-response (get @chat-messages thread-id))))

(defn new-chat-thread [channel-id thread-name]
  (let [new-id (next-id)]
