Refactor string functions, fix many defects.

Okay, what's the intent though? To not be NACK? Shouldn't we therefore test for that?