Improve speed of partitions