Refactoring (use script local function)