added automatic partitioning