Issue 868 category constraint

Closes #868