   [request]
   (ring-resp/response "Hello, World!"))
 
-
+;; Define route handlers
 (defroutes routes
   [[
+  [  "/plaintext" {:get plaintext}]
   [  "/json"      {:get json-serialization}]
   [  "/db"        {:get single-query-test}]
-  [  "/queries"   {:get multiple-query-test}]
+  [  "/queries"   {:get multiple-queries-test}]
   [  "/fortunes"  {:get fortune-test}]
-  [  "/updates"   {:get db-updates}]
-  [  "/plaintext" {:get plaintext}]]])
+  [  "/updates"   {:get db-updates}]]])
 
 
 (def service

    (fortunes-hiccup)
    (ring-resp/response)
    (ring-resp/content-type "text/html")
    (ring-resp/charset "utf-8")))         ;; Apply charset after content type


(defn update-and-persist
  "Changes the :randomNumber of a number of world entities.
  Persists the changes to sql then returns the updated entities"
  [request]
  (let [results (-> request
                    (sanitizeQueriesParam)
                    (run-queries))]
    (for [w results]
      (update-in w [:randomNumber (inc (rand-int 9999))]
        (update world
                (set-fields {:randomNumber (:randomNumber w)})
                (where {:id [:id w]}))))
    results))


(defn db-updates
  "Test 5: Database updates"
  [request]
  (-> request
      (update-and-persist)
      (bootstrap/json-response)))


  []
  (sort-by #(:message %)
    (conj
      (get-all-fortunes-korma)
      { :id 0 :message "Additional fortune added at request time." })))

(defn fortunes-hiccup
  "Render the given fortunes to simple HTML using Hiccup."
