refactoring peg package