Add the averaging part.