clusteredTerms Method + other refactoring