refactor singly linked list