Added TLS. Fixed some config issues