Vectorized for loop