refactor history table