updated vectorization