implemented undo + redo and therby added curBuffer to state