Added more stopping criteria.