Median function added.