Working p11 code