use bytes for reading input, remove unneeded terminal restore call