Simplified the inject_into_tty_buffer routine. Mostly, directly use