Use stopping conditions

Use stopping conditions

Stop iteration when tolerance is met or maximum iterations reached.