WIP on implementing and testing categorize-item. Some test and code refactoring.