Seperated key steps,fixed public key issue