Moved API calls to separate method call to eliminate duplicate code