sorting data before reporting