Starting facet tree generating code. WIP.