Replaced accumulators with RDD.aggregate