SSL refactoring