Update to average calculation for Github Issue #5202