Small refactoring of history engine.