Eliminate allocation of unused arrays, only allocate arrays of the needed size.