Refactoring how the functions are called with the api key and token.