Refactored - now got top level scope invokeWineApi function.