Refactor executeSedScript to fewer lines

Is this easier to understand? Not convinced.
Remove type definition of inner function