comments + minor improvements to queryhandler