fixed the ring structure in addToRing and removed the function setSuccessor.