Implemented undo/redo in the UI