Implemented simple version of tls