refactoring of TrendsRanker