flatMap mostly done: now requires a merge(Seq[K], Tree, Tree) method to
account for the subtleties of merging, to replace the current 'replace'
boolean.