terminal code cleaned