Implementing the loop checker procedure