Make the P2 initialization code reusable