           (println "Wowah, exception:\n" e)
           (.printStackTrace e))))))
 
+(def imap-ns (ns-name *ns*))
 
 (defn serve-forever
   [port]
+  (if (pos?  settings/reload-interval)
+    (future ; Run the reloader in another thread
+      (loop [file (File. "src/clojure/neveragain/imap.clj")
+             last-mod (.lastModified file)]
+        (Thread/sleep (* settings/reload-interval 1000))
+        (if (> (.lastModified file) last-mod)
+          (do
+            (println "Reloading imap namespace")
+            (require imap-ns :reload)
+            (recur file (.lastModified file)))
+          (recur file last-mod)))))
   (as/serve-forever port connection-handler))
 
 (defn -main [& args]

    (clojure [string :as string]
             [set :as set-lib]
             [pprint :as pprint])
    (clojure.core [async :refer [>! <! >!! alts! go go-loop]])
    (swiss [arrows :refer :all])
    (clojure.java [jdbc :as j])
    (neveragain [common :as common]

                  "LOGOUT" (wrap-pure-imap-verb logout)
                  "UID" (wrap-pure-imap-verb uid-mux)})

(def reload-chan (chan 2))

(defn connection-handler
  [r-chan w-chan]
  (>!! w-chan 
       "* OK Hail! ChainMail IMAP server at thine service my liege!\r\n")
  (go-loop [[read-val source] (alts! [r-chan reload-chan])
            session {}]
    (try
      (let [[line tag verb args] (re-matches #"(.+?)\s(\S+)\s?(.+)?" read-val)]
        (if-not line
          (do
            (>!! w-chan "* BAD Hark knave, thine command parses not!\r\n")
            (recur (alts! [r-chan reload-chan]) session))
          (let [handler (get handler-map (.toUpperCase verb) null-verb)
                new-session (handler session r-chan w-chan [line tag verb args])]
            (recur (alts! [r-chan reload-chan]) new-session))))
      (catch Exception e
        (do
          (>!! w-chan
