Refactor SSL process