simplified category code generation a bit