improving query for selected images