Refactored p1