Implemented sorting and categorization