Add PID values to average function