modified for xterm