History refactor