Implemented undo/redo, Created functions applyAction() and revertAction()