now vectorized so it can handle multiple queries