port from node-doubly-linked-list