added sorting function and popup before removing all candidate mappings