add the function sort, which can sort output alphabetically.