finalized code + comment for PD3