Fixed the split function to work properly.