updated to use `LinkedList`