used faster sort for topic queries and fixed output formatting