typos
some refactoring of openssl stuff