better way of doing number keyed freq map median