finished with 'sort' function