attempt to refactor query and cursor
integrate cursor/buffer pagination into the query class