Refactoring p1