Sort the list by priority and add items