#KJ-46 Optimize the implementation of functions that categorize labels. Implemented most of label categories this way. Result - a lot of changes, virtually no performance improvement.