improved the partition list with in-place implementation