Minor changes to code (to deal with a slightly changed API) and some new tests for undo/redo