master update sort and back trace