insert refactor