Move isSorted to a sort_helpers file