Add defs for nub and nubBy.
Remove unused variable z.
Fix nub, nubBy.
Log the number of categories.