Category infra

Fixes #345