added is_sorted method