changed CHIQuery object and removed extraneous code.