made peg functions easier to create