Refactored p4