process_topics function

Process topics