new partitioning logic