Switch to mapPartitions