Getting terminal emulation working