             #(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)))]

(defn chat-threads-handler [request]
  (let [params (:route-params request)
        channel-id (read-string (:channel-id params))]
    {:status 200
     :headers {"Content-Type" "application/edn"}
     :body (pr-str (get @chat-threads channel-id))}))

(defn chat-messages-handler [request]
  (let [params (:route-params request)
        thread-id (read-string (:thread-id params))]
    {:status 200
     :headers {"Content-Type" "application/edn"}
     :body (pr-str (get @chat-messages thread-id))}))

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

                              :app :chat}}))))
      (alter chat-threads
        #(conj % {new-id {}}))))
  (edn-response @channels))

(defn new-channel-handler [request]
  (let [body (read-string (slurp (:body request)))]
