merge Jennie's code for partitioning-planner