refactoring: handling of terms