Refactor out useless local function on new-shell