refactoring for PIP