changing partitioning code