Further modularised the certificate generator