Improved the api-topic script