added terminal code