Better parsing of strings in wrap() function.