Added for loop detection