Applied the sorting at the branches