implemented convergence criterion