refactored topics controller