updated the injection function to support creating new file