New average algorithm