   (let [x (int (/ x note-width))
         y (int (/ y note-height))
         length (count @active-notes-atom)
-        return-note (atom (contains-in? @active-notes-atom x y note-width))
+        return-note (atom (get-note @active-notes-atom x y note-width))
         new-note-data {:velocity 1.0 :duration 1}]
 
       (if (not (nil? @return-note))
         (do
             (doseq [[k note] @return-note] 
               (doseq [[n note-data] note] 
-               ; (swap! return-note (fn [_] {k {n note-data}} ))
                 (swap! x-cell (fn [_] k))
                 (swap! y-cell (fn [_] n)))))
         (do 


(def NUM_BEATS 4)
(def NUM_BARS 4)


(defn note-matrix [notes n-octaves n-measures n-bars n-beats n-steps-per-beat]

                       (>= (- x 1) note-x)
                       (= y note-y)) ;; bounds checking
                       (do
                          (swap! r (fn [_] {note-x {note-y data}}))))
                        )))))
    @r))


