Refinements to string functions