Rename to_vec and to_sorted_vec
Refactored and renamed functions to avoid failure