hisotry refactor service