added tty function