changing rest of the code to use dlist