Started reorganizing query generator, and resultset classes