added convergence criterion