Slight changes to pagination code.