adding history saving