Errors: Map is sorted by key, not value. Counting is not implemented right