Make the code that prevents an infinite loop from happening into a case insensitive...