stringDelimiter function completely refactored