optimize domain querying