these should probably be nanmedian, not nansum