Using sorted() to put data in order