Improved terminal input