Adding thread to return output for each category