refactored termclassing