working on sorting and callback functions for categories tab