initial changes to add tls support