Adjusted API calls to internal function to contain apikey