Adding p12 generating function.