added sorting to categories