implement reverse terminal code