Refactor the require call insertion code.