sort the flat list of elements alphabetically