Slight modifications to Tom Janssens's excellent minimalistic telnet library