refactored working ssl