Added error handling for when there are no more results