Added command pattern for undo/redo