added better D3PD script