Refactoring for x509