removing is_sorted function