                     (when s (system/stop s)))))
 
 (defn reset
-  "Resets the development environment, reloading any changed namespaces and
-  restarting the CMR services.
-
-  Note that when an explicit mode is passed as an argument, not only will CMR
-  be restarted in that mode, but the namespace-level `user/mode` variable will
-  be reset to the given value."
-  ([]
-    (reset mode))
-  ([new-mode]
-    ;; Stop the system integration test system
-    (sit-sys/stop)
-    ; Stops the running code
-    (stop)
-    ; Refreshes all of the code and then restarts the system
-    (set-mode! new-mode)
-    (refresh :after 'user/start)))
+  "Resets the development environment, taking optional keyword arguments for
+  various run modes (see the docstring for `set-modes!` for more details).
+  Environment resetting includes the reloading of any changed namespaces and
+  the restarting the CMR services.
+
+  Note that when one or more explicit modes are passed as arguments, the global
+  `run-modes` data structure is updated.
+
+  If a run mode for a particular component is not passed, its value taken from
+  what is already in the `run-modes` global data structure. If no mode has been
+  set, the default from initialization will be used."
+  ;; Note that even through the named args are not used, they are provided as
+  ;; a means of self-documentation.
+  [& {:keys [elastic echo db messaging] :as new-modes}]
+  (when-not (empty? new-modes)
+    (apply set-modes! (mapcat seq new-modes)))
+  ;; Stop the system integration test system
+  (sit-sys/stop)
+  ; Stops the running code
+  (stop)
+  ; Refreshes all of the code and then restarts the system
+  (refresh :after 'user/start))
 
 (defn run-all-tests-future
   "Runs all tests asynchronously, with :fail-fast? and :speak? enabled."

(selmer/cache-off!)

(defonce system nil)
(defonce mode (or (keyword (System/getProperty "cmr.runmode")) :in-memory))
(defonce legacy? false)
(defonce aws? false)


  (transmit-config/set-administrators-group-legacy-guid! "316520E041894014E050007F010038C4"))

(defn start
  "Starts the current development system, taking optional keyword arguments for
  various run modes (see the docstring for `set-modes!` for more details).

  Note that when one or more explicit modes are passed as arguments, the global
  `run-modes` data structure is updated.

  If a run mode for a particular component is not passed, its value taken from
  what is already in the `run-modes` global data structure. If no mode has been
  set, the default from initialization will be used."
  ;; Note that even through the named args are not used, they are provided as
  ;; a means of self-documentation.
  [& {:keys [elastic echo db messaging] :as new-modes}]
  (when-not (empty? new-modes)
    (apply set-modes! (mapcat seq new-modes)))
  (config/reset-config-values)

  (jobs/set-default-job-start-delay! (* 3 3600))

  (system/set-gorilla-repl-port! 8090)

  (system/set-dev-system-elastic-type! (:elastic run-modes))
  ;; NOTE: External ECHO does not work with the automated tests. The automated
  ;; tests expect they can interact with the Mock ECHO to setup users, acls,
  ;; and other ECHO objects.
  (system/set-dev-system-echo-type! (:echo run-modes))
  ;; IMPORTANT: MAKE SURE YOU DISABLE SYMANTEC ANTIVIRUS BEFORE STARTING THE
  ;; TESTS WITH EXTERNAL DB (re-enable them when you're done)
  (system/set-dev-system-db-type! (:db run-modes))
  ;; If you would like to run CMR with :aws instead of :in-memory or :external,
  ;; be sure to call `(set-aws true)` in the REPL.
  (if aws?
    (system/set-dev-system-message-queue-type! :aws)
    (system/set-dev-system-message-queue-type! (:messaging run-modes)))

  (sit-sys/set-logging-level @settings/logging-level)

  ;; If you would like to run CMR with legacy support, then be sure to call
  ;; `(set-legacy true)` in the REPL. There is currently no lein profile or
  ;; command line option for this.
  (when legacy?
    (configure-for-legacy-services))
