Revised cert creation code