Using reducer instead of sortByKey