Updated to do auto pagination.