new logic for categorizing