Optimizations to TopicAnalyzer