Added sorting according to categories