add topic extraction, refactor