Refaktoring the topic list function