refactoring the external call