implemented median. It will be highly inefficient though, as the second scanner will be invoked once for every map entry. TODO: Fix this