Refactoring. Moved replacing for SSL into own method