refactor history