Refactor string functions, fix many defects.

Can we guarantee the order, aren't we better off checking if it's != RDM_NACK_REASON?