refactor TopicHandler.