modified the get_all_ids function to be nicer to the API