implement avg data opt