code refactoring,  jsdoc added, updated  file injection logic