Finished version 1 of processUnbufferedInput.