Cleanup and (mostly) document util/string.h and (very) minor refactoring