Median

I've added a median function. I messed up earlier so lets see how this goes.