 
 ;; Until reset, this will save all references. The same number crisis will
 ;; continue to return the same names for ##REF-TAGS##
-(def namedItems
-  "A map atom with references as keys and named items as values"
-  (atom {}))
+;; It is done this way so names aren't overwritten during frequent updating
+;; (resaving source files will re-load them into memory)
+(defn init-named-items
+  "Checks if namedItems is initialised. If not, initialise it"
+  []
+  (if (not (resolve 'namedItems))
+    (def namedItems
+      "A map atom with references as keys and named items as values"
+      (atom {}))))
+
+(init-named-items)
 
 (defn reset-named-items!
   "Resets the namedItems atom"

  "Adds the reference name pair to namedItems, overwriting any previous allocation.
  Returns the added name"
  ([keyRef valName]
   (swap! namedItems assoc keyRef valName)
   valName)
  ([[keyRef valName]]

(defn get-name
  "Returns the referenced name from namedItems, or nil if not existing"
  [keyName]
  (init-named-items)
  (get @namedItems keyName))

(defn named-exists?
  "Returns true if the named item already exists in namedItems, else false"
  [refName]
  (init-named-items)
  (if (some #{refName} (vals @namedItems))
    true
    false))
