made refactoring in updateScript method