Added retrieval of terminal-type from telnet codes and a /tt command

Also renamed a couple of variables for hopefully improved clarity