history optimization