Refactor string functions, fix many defects.

Again please.