Refactor get_user_sort_dict.