Refactored to use factory to return restful API call