finished and tested QueryAction class, corrected some bugs