Refactor insert.