code to work with topics