Fixing history leak and adding Ctrl-x exit cmd.
Fixing left/right keys.