More of auto_partition.py done (still not used)