I added a median

You can review and merge this as you see fit.