Implement partition.