new method for paginating query results added