Refactor of Invoke method.