added in partitioning code