Completed the median approach