                               (over/overh parent phrasal-children morph)))
                           )
                         )
-                       candidate-parents))]
+                       candidate-heads))]
         (if (lexemes-before-phrases)
           (lazy-cat lexical phrasal)
           (lazy-cat phrasal lexical))))))


        depth (if depth depth 0)        
        ;; TODO: unifyc is expensive: factor out into a let.
        debug (log/debug (str "looking for candidate parents with parent: " (:rule parent) " and spec: " (strip-refs spec)))
        candidate-parents (filter #(not (fail? %))
                                  (map (fn [rule]
                                         (do (log/debug (str "testing rule::: " (:rule rule)))
                                             (log/debug (str " result: " (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 (get-head-phrases-of parent index)
                                           grammar)))

        debug (log/debug (str "done looking for candidate parents: "
                              (if (empty? candidate-parents)
                                "no candidate parents found."
                                (str "one or more candidate parents found; first: " (:rule (first candidate-parents))))))
        
        debug (if (not (empty? candidate-parents))
                (log/debug (str "candidate-parents: " (string/join "," (map #(get-in % [:rule])
                                                                            candidate-parents))))
                (log/debug (str "no candidate-parents for spec: " (strip-refs spec))))]
    ;; TODO: remove or parameterize this hard-coded value.
    (if (> depth 5)
      (throw (exception (str "DEPTH IS GREATER THAN 5; HOW DID YOU END UP IN THIS TERRIBLE SITUATION? LOOK AT THE STACK. I'M OUTTA HERE."))))

    (if (seq candidate-parents)
      (let [lexical ;; 1. generate list of all phrases where the head child of each parent is a lexeme.
            (mapcat (fn [parent]
                      (let [head-is-phrasal (get-in parent [:head :phrasal] false)
                            candidate-lexemes (if (not (= true head-is-phrasal))
                                                (get-lex parent :head index spec))]
                        (log/trace
                         (str "candidate head lexemes for parent phrase "
                              (get-in parent [:rule]) ": "
                              (string/join ","

            cached (if (and true cache)
                     (do
                       (let [result (get-lex immediate-parent :comp cache spec)]
                         (log/debug (str "GET-LEX: " (string/join " " (map morph result))))
                         (if (not (nil? result))
                           (log/debug (str " cached lexical subset ratio: " 
                                           (string/replace (str (/ (* 1.0 (/ (count lexicon) (count result)))))
