changed list.sort() to sorted(list)