Add maybe_split function