Check tty only once at startup
Speed hack: drop HTML::Parse, do it manually