   (:gen-class))
 
 (def logger (Logger/getLogger "demogorgon.core"))
-(def *connection* (irc/create (:irc config)))
-(def *nh* (nh-init *connection*))
-(def *web* (ref nil))
 
 (defn get-memory-info []
   (let [runtime (Runtime/getRuntime)

        word (aget words idx)]
    word))

(defn -main[& args]
  (try 
   (let [logger (Logger/getLogger "main")]
     (nh-start *nh*)
     
     (irc-hooks/add-message-hook *connection* #"^\.rng (.+)" #'rand-hook)
     (irc-hooks/add-message-hook *connection* #"^\.rnd (.+)" #'rand-hook)
     (irc-hooks/add-message-hook *connection* #"^\.random (.+)" #'rand-hook)
     (irc-hooks/add-message-hook *connection* ".debug" (fn [& rest] (get-memory-info)))
     (irc-hooks/add-message-hook *connection* ".gc" (fn [& rest] (.gc (Runtime/getRuntime))))
     (irc-hooks/add-message-hook *connection* #"^\.u ?(.*)?" #'unicode-hook)
     (irc-hooks/add-message-hook *connection* ".cur" #'online-players-hook)
     (irc-hooks/add-message-hook *connection* ".online" #'online-players-hook)
     (irc-hooks/add-message-hook *connection* #"^\.last ?(.*)?" #'last-dump-hook)
     (irc-hooks/add-message-hook *connection* #"^\.lastdump ?(.*)?" #'last-dump-hook)
     (irc-hooks/add-message-hook *connection* #"^\.lasturl ?(.*)?" #'last-dump-hook)
     (irc-hooks/add-message-hook *connection* #"^\.whereis ?(.*)?" #'whereis-hook)
     (irc/connect *connection*)
     (dosync
      (ref-set *web* (start-web))))
   (catch Exception e
     (pst e))))

    (str "used " used " free " free " total " total " max " max)))

(defn print-debug []
  (.debug logger (str "before " (get-memory-info)))
  (.gc (Runtime/getRuntime))
  (.debug logger (str "after  " (get-memory-info))))
