crude attempt at switching to TLS. It works, but has some kludges