many changes to plotqueryhandler