I added a median function