code for d()