added smarter telnet