Use of function sort instead of sorted