v0.06 - totLoss replaced with avgLoss