refactored inject script