refactored invocation logic