i added a median function