Added sort_mode option