made gitMedian more efficient