Pre-build item -> category mapping and simplify / optimize all the generation code as a result.