got partitioning code to work