fixed a bug with calculating totals
refactored querypanecontroller, resultgridcontroller, resultgrid