implemented undo/redo feature