added med3func for numeric median of 3