here is the new median function

This is nice.