added better terminal support