In the process of adding undo and redo functionality