do some intelligent querying