edit the history function