slight changes to deal with pagination end