faster version for getCategoryAndCode