Added code to migrate history