Doubly linked list refactor