Category infra

Fixes #345
This just refactored a little for my own sake