add history saving