Improve string utility functions and make entity popup menu categorized.