Updated the template class for doubly linked list