reformat code for topic implementaion