Big refactor of how TREs are parsed and flattened.
Refactor out part of the TRE flattening code.