finish refactoring and modify history module