add support to paginate results from API, better error handling