created a linked list used a tail-reference