 ;;config
 
 
+(def config (atom {}))
 
 (defn load-config []
-  (def config  (read-string (slurp (str (System/getProperty "user.home") java.io.File/separator ".btc-coffee.clj"))))
+  (reset! config (read-string (slurp (str (System/getProperty "user.home") java.io.File/separator ".btc-coffee.clj"))))
   )
 ;;(load-config)
 
 (defn get-config [key]
-  (get config key))
+  (get @config key))
 
 (defn curconv "convert between currencies"
   [amount from to ]
-  (let [rates (get (get (client/get (format  "http://openexchangerates.org/api/latest.json?app_id=%s"
-                                             (get-config :ocx-key)) {:as :json}) :body) :rates)]
+  (let [rates
+        (get-in (client/get (format  "http://openexchangerates.org/api/latest.json?app_id=%s"
+                                     (get-config :ocx-key)) {:as :json}) [:body :rates])]
     (* (* amount  (get rates to)
           (/ 1  (get rates from))))))
 

                             (curconv (get-config :amount) (get-config :from) :BTC )
                             (get-config :label)                             
                             (clj-http.util/url-encode (get-config :message)  )))

(defn qr-encode-to-stream
  "qr encode and stuf"

  "a payment has arrived"
  []
  ()
  (send-message        (str "Payment received " (java.util.Date.)))

  ( schedule-task 2000 (send-message "Scan for Coffee!"))
  )


