move query to config