 (defn add-complement-to-bolt [bolt path spec language-model depth total-depth
                               & {:keys [max-total-depth]
                                  :or {max-total-depth max-total-depth}}]
-  (log/debug (str "add-complement-to-bolt: start: " (show-bolt bolt path language-model) "@"
+  (log/trace (str "add-complement-to-bolt: start: " (show-bolt bolt path language-model) "@"
                   (string/join " " path)))
   (let [index (:index language-model)
         lexicon (:lexicon language-model)

(declare add-all-comps)
(declare candidate-parents)
(declare lazy-shuffle)

(defn generate-all [spec language-model total-depth
                    & {:keys [max-total-depth truncate-children]

  (log/debug (str "generate-all: generating from spec with spec "
                  (strip-refs spec) "; max total depth: " max-total-depth))
  
  (let [total-depth (if total-depth total-depth 0)]
    (->
     (lightning-bolts language-model spec 0 total-depth :max-total-depth max-total-depth)
     (add-all-comps-to-bolts spec language-model total-depth)
     (truncate-expressions [[:head][:comp]])
     )))

(defn add-all-comps-to-bolts [bolts spec language-model total-depth]
  (log/debug (str "add-all-comps-to-bolts with (empty? bolts): " (empty? bolts)
                  "; spec: " (strip-refs spec)))
  (cond
    (= spec :fail)
    nil
    true
    (lazy-mapcat
     (fn [bolt]
       (add-all-comps-to-bolts-with-paths [bolt] spec language-model total-depth
                                          (find-comp-paths-in bolt [:head])))
     bolts)))

(defn add-all-comps-to-bolts-with-paths [bolts spec language-model total-depth comp-paths]
  (log/trace (str "add-all-comps-to-bolts-with-paths with (empty? bolts): "
                  (empty? bolts) "; spec: " (strip-refs spec)))
  (cond (= spec :fail)
        nil
        true
        (if (not (empty? comp-paths))
          (let [path (first comp-paths)]
            (add-all-comps-to-bolts-with-paths
             (lazy-mapcat
              (fn [bolt]
                (log/debug (str "+comps: " ((:morph language-model) bolt) "@" "[" (string/join " " path) "]"))
                (add-complement-to-bolt bolt path spec
                                        language-model 0 total-depth
                                        :max-total-depth max-total-depth))
              bolts)
             spec
             language-model
             total-depth
             (rest comp-paths)))
          bolts)))

(defn find-comp-paths-in [bolt path]
  (if (not (= (get-in bolt path :none) :none))
