Add terminating condition when algorithm fails to converge.