Refactored p12