extended: delete duplicate entries and reformat