Added undo feature. Kinda slow, not quite complete.
Use better deque.
Merge branch 'bsim' into bsim-undo. Also fixed tty undo and stuff.
Added missing verify.js file.