beginning of telnet impl