Use reduceByKey + collectAsMap instead of modifying a map