peggd sample code