Added a flattener.  Working on adding diagram converter logic.