Updated to support CTRL-Z/CTRL-Y