List sorting and initialization