Improved dl function