fixed way of processing median and maximum numbers