implemented do/undo/redo pattern