Move history functionality to stateManager