addding more stopping criteria