keypair clean functions added