add rsa functions, cleanup