Add partition_horizontal and partition_grid. Add unit tests for partitioning.