doQuery and auxiliar methods. basic grid functionality in place