                                            (log/debug (str "not getting head phrases: using grammar"))
                                            grammar))))
 
-        debug (log/debug (str "done looking for candidate head phrases: "
+        debug (log/trace (str "done looking for candidate head phrases: "
                               (if (empty? candidate-heads)
                                 "no candidate heads found."
                                 (str "one or more candidate heads found; first: " (:rule (first candidate-heads))))))

  (if (and (not (= :fail spec))
           (not (= :top spec))
           (not (empty? (strip-refs spec))))
    (log/debug (str "lighting-bolt@" depth " spec: " (strip-refs spec) "; parent: " (if parent
                                                                                      (:rule parent)))))
  (if (not parent)
    (log/debug (str "no parent for lightning-bolt@" depth " with spec: " (strip-refs spec))))
  (let [maxdepth 3 ;; maximum depth of a lightning bolt: H1 -> H2 -> H3 where H3 must be a lexeme, not a phrase.
        debug (log/debug (str "lightning-bolt@" depth " grammar:" (string/join ", " (map #(get-in % [:rule]) grammar))))

        depth (if depth depth 0)        
        ;; TODO: unifyc is expensive: factor out into a let.
        debug (log/debug (str "looking for candidate head phrases with parent: " (:rule parent) " and spec: " (strip-refs spec)))
        candidate-heads (filter #(not (fail? %))
                                  (map (fn [rule]
                                         (do (log/debug (str "testing rule: " (:rule rule)
                                                             ":" (strip-refs rule)))
                                             (if (fail? rule)
                                               (throw (exception (str "rule has a fail: " (strip-refs rule)))))
                                             (log/debug (str " result: " (strip-refs (unifyc spec rule))))
                                             (log/debug (if (fail? (unifyc spec rule))
                                                          (str "fail path: " (fail-path-between spec rule))
                                                          (str "rule: " (:rule rule) " successfully unified with spec: " (strip-refs spec))))
                                             (unifyc spec rule)))
                                       (if parent
                                         (let [hp (get-head-phrases-of parent index)]

            complement-candidate-lexemes (if (not (= true
                                                     (get-in bolt (concat path [:phrasal]))))
                                           (if cached cached (flatten (vals lexicon))))]
        (log/debug (str " immediate parent:" (get-in immediate-parent [:rule])))
        (let [complement-pre-check (fn [child parent path-to-child]
                                     (let [child-in-bolt (get-in bolt path-to-child)]
