added function to export by category