Solved GetMedian method