updated to handle empty inputs for the split.