move resolveListOfK step above flattenTerms