Query and config handling