Udadated dl function, tidied commenting