Modifying the api to allow pagination