refactored api calls to diff class