change back to putting flattenTerms before FlattenSyntax