refactored call function into API/call