Implemendetd undo()