Added sort of input to is_merge