Better loop recursion protection.