    If the selection is not empty, the second loc will give the end (get it via a call to 'loc-end on it).
    Pre-requisites: length >=0, offset >=0. rloc = root loc of the tree"
   [rloc offset length]
-  (spy "+++++++++")
-  (let [left-leave (parse-node (leave-for-offset rloc offset))
-        _ (spy "1st ll" (zip/node left-leave))
-        right-leave (leave-for-offset rloc (+ offset length))
-        _ (spy "1st rl" (zip/node right-leave))
+  ;(spy "+++++++++")
+  (let [left-leave (parse-leave (leave-for-offset rloc offset))
+        ;_ (spy "1st ll" (zip/node left-leave))
+        right-leave (parse-leave (leave-for-offset rloc (+ offset length)))
+        ;_ (spy "1st rl" (zip/node right-leave))
         right-leave (cond 
                       (= :root (loc-tag right-leave)) 
-                        (parse-node (leave-for-offset rloc (dec (+ offset length)))) 
+                        (parse-leave (leave-for-offset rloc (dec (+ offset length)))) 
                       (not= (+ offset length) (start-offset right-leave))
                         (parse-node right-leave) 
                       (nil? (seq (previous-leaves right-leave)))
                         (parse-node right-leave)
                       :else
                         (parse-node (first (previous-leaves right-leave))))
-        _ (spy "2d rl" (zip/node right-leave))
+        ;_ (spy "2d rl" (zip/node right-leave))
         ]
     (if (or
           (= [0 0] [offset length])
           (and 
-            (= (start-offset left-leave) offset) 
-            (= (end-offset right-leave) (+ offset length))  
-            (same-parent? left-leave right-leave))) 
+            (= 0 length)
+            (= (start-offset left-leave) offset))
+          (and 
+            (= (start-offset (parse-node left-leave)) offset)
+            (= (end-offset (parse-node right-leave)) (+ offset length))  
+            (same-parent? (parse-node left-leave) (parse-node right-leave)))) 
+      (do ;(spy "already normalized")
+        [left-leave (when-not (zero? length) right-leave)])
       (do
-        [left-leave (when-not (zero? length) right-leave)])
-      (let [left-leave (parse-node left-leave)
+        ;(spy "not yet normalized")
+        (let [left-leave (parse-node left-leave)
             right-leave (parse-node right-leave)
             min-depth (min (loc-depth left-leave) (loc-depth right-leave))
             left-leave (up-to-depth left-leave min-depth)

            (fn [[l r]] (= (zip/up l) (zip/up r))) 
            (iterate 
              (fn [[l r]] [(zip/up l) (zip/up r)])
              [left-leave right-leave]))))))) 

(deftest normalized-selection-tests
  (are [text offset length expected-offset expected-length]

    "foo (bar baz)" 4 4 4 9
    "foo (bar baz)" 9 4 4 9 
    "foo (bar baz)" 0 0 0 0
    "(foo bar)" 8 0 8 0
    "foo (bar baz)" 12 1 4 9 
    ))

(defn sel-match-normalized? 
