Adding list loop detection.