Cleaned some code in auto_partition.py and added some debug messages