added ssl
refactor