added terminal type discovery