PartitionList-refactor the code