Refactored p3