fixes logic around category resolution
working prototype