Added split_nonempty function.