I added the median function