                                               ",path=" path ",bolt=(" (show-bolt bolt path morph)
                                               "): calling generate-all(" (strip-refs spec) ");"
                                               "input-spec: " input-spec))
-                        phrasal-complements (if (> max-total-depth total-depth)
-                                              (lazy-seq (generate-all spec grammar lexicon cache morph (+ depth total-depth))))]
+                        phrasal-complements (if (and (> max-total-depth total-depth)
+                                                     (= true (get-in spec [:phrasal] true)))
+                                              (generate-all spec grammar lexicon cache morph (+ depth total-depth)))]
                     (if (lexemes-before-phrases total-depth)
                       (lazy-cat filtered-lexical-complements phrasal-complements)
                       (lazy-cat phrasal-complements filtered-lexical-complements)))))))

        (let [lexical ;; 1. generate list of all phrases where the head child of each parent is a lexeme.
              (mapcat (fn [parent]
                        (if (= false (get-in parent [:head :phrasal] false))
                          (let [candidate-lexemes (lazy-seq (get-lex parent :head index spec))
                                results (filter #(not (nil? %))
                                                (over/overh parent (mapfn copy candidate-lexemes)))]
                            (log/debug (str "lightning-bolt: " (get-in parent [:rule])
                                            ": first candidate head lexeme:"
                                            (let [fo (morph (first candidate-lexemes))]
                                              (if (or (nil? fo)
                                                      (= '' (trim fo)))
                                                (str
                                                 "'"
                                                 (get-in (first candidate-lexemes)
                                                         [:english :english])
                                                 "'")
                                                (str fo)))))
                            results)))
                      parents)
              phrasal ;; 2. generate list of all phrases where the head child of each parent is itself a phrase.
              (if (< depth max-total-depth)

    result))

(defn add-complement [bolt path spec grammar lexicon cache morph depth total-depth]
  (log/debug (str "add-complement: start: " (show-bolt bolt path morph)))
  (let [input-spec spec
        from-bolt bolt ;; so we can show what (add-complement) did to the input bolt, for logging.
        spec (unifyc spec (get-in bolt path))
        immediate-parent (get-in bolt (butlast path))
        complement-candidate-lexemes (if (not (= true
                                                 (get-in bolt (concat path [:phrasal]))))
                                       (let [cached (if cache
