Adding cyclic checking to singly linked list.