refactor invoker to use context