 
 ;; For running from the repl
 (defn start []
-  (alter-var-root #'app-state (comp launch connect-db)))
+  (swap! app-state (comp launch connect-db)))
 
 (defn stop []
-  (alter-var-root #'app-state (comp disconnect-db halt)))
+  (swap! app-state (comp disconnect-db halt)))
 
 ;; For running using lein-ring server
-(defonce lein-ring-handler nil)
+(defonce lein-ring-handler (atom nil))
 
 (defn lein-ring-init []
   (prn "lein-ring-init")
-  (alter-var-root #'app-state connect-db)
-  (alter-var-root #'lein-ring-handler
+  (swap! app-state connect-db)
+  (swap! lein-ring-handler
                   (fn [_] (let [config-m (config/create-config)
                                 db (:db app-state)
                                 stores-m (storage/create-mongo-stores db)

        #_(mw-logger/wrap-with-logger))))

;; launching and halting the app
(defonce app-state {})

(defn connect-db [app-state]
  (if (:db app-state)

                            (create-app config-m stores-m blockchain)))))

(defn lein-ring-stop []
  (swap! app-state disconnect-db))
