updated to use ssl sockets