Simplified the split for different delimiters by creating a new function