Updated search query script