Improved category assignment