added sorting by categories