revised Balanced_Partition