refactoring insert and hashpage.