updated image search logic