Added logic for supporting SSL