move flattenTerms like a KAST translator