add the histroy function