Created a check to prevent an infinite loop on circular structures. Circular structures now work.