updated LinkedList sample code