generalized automatic querying added