simpler, awesomer median function