 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defn flatten-selectors
+  "Transforms a group of selectors as received from 
+  defselector to a group of pairs [selector action], 
+  removing nested selectors and putting all of them 
+  on the first level."
   ([actions] (partition 2 (flatten-selectors () actions)))
   ([base actions]
     (match [actions]

(defn- matching-element [selector history]
  (first (select-element selector history)))

(defn selector-visitor [selectors select-visit? visit-fn]
  (fn [elem w]
    (cond
      (not (select-visit? elem))

      :else
        [elem new-history])))

(defn select-element 
  "Grabas an element from history that matches a group
  of selectors, respecting a heriarchy of multiple elements
  in between."
  [selectors history]
  (loop [current-history  history
         current-selector (first selectors)
         rest-selectors   (rest selectors)]
