   (let [channel-names (keys channels-map)
         procs (for [chan channel-names]
                 (let [tile-index (assoc tile-indices :nc chan)]
-                  (tile-cache/get-tile memory-tiles-atom tile-index)))
+                  (tile-cache/load-tile memory-tiles-atom tile-index)))
         lut-maps (map channels-map channel-names)]
     (overlay-memo procs lut-maps)))
 

                         (multi-color-tile memory-tile-atom tile
                                           (:channels @screen-state-atom)))))

(defn monochrome-loader
  "Loads monochrome tiles needed for drawing."
  [screen-state-atom memory-tile-atom]
  (doseq [tile (mapcat #(visible-tile-indices @screen-state-atom %)
                       (keys (:channels @screen-state-atom)))]
    (tile-cache/load-tile memory-tile-atom tile)))

(defn load-visible-only
  "Runs visible-loader whenever screen-state-atom changes."
  [screen-state-atom memory-tile-atom
   overlay-tiles-atom acquired-images]
  (let [load-monochrome (fn [_ _]
                          (monochrome-loader
                            screen-state-atom
                            memory-tile-atom))
        load-overlay (fn [_ _]
                       (overlay-loader
                         screen-state-atom
                         memory-tile-atom

        agent (agent {})]
    (def agent1 agent)
    (reactive/handle-update
      screen-state-atom
      load-overlay
      agent)
    (reactive/handle-update
      acquired-images
      load-overlay
      agent)))
  
;; MAIN WINDOW AND PANEL
