computes median instead of mean