better rsa base.. refactoring needed