Monoid, first version of frequencyMap