       (do
         (alter-var-root #'system
           (constantly ((components/init mode))))
-        (alter-var-root #'state (fn [_] :initialized))))
-    state))
+        (:system (set-state! :system :initialized))))))
 
 (defn deinit
   []

    (do
      (alter-var-root #'system
        (fn [s] (when s (component/stop s))))
      (alter-var-root #'state (fn [_] :stopped))))
  state)

(defn restart
  []

;;;   Initial Setup & Utility Functions   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; The next line is used to set a default log-level before the logging
;; component has been started (which only happens when the system is started).
(logger/set-level! '[cmr] :info)

(defn set-log-level!
  [log-level]
  (logger/set-level! '[cmr] log-level))

(defn get-process
  [service-key]
