Adding the undo behaviour to the command pattern implementation