refactoring of inserter