new assign partitions code