Updated to work on arbitrary whitespace characters.