changed pd code a bit