Yay, finally the undo/redo is working sort of properly..