Added categorization logic