Also: the sort method doesn't apply to mean.  Perhaps move max and min to join sort, below ?