updated optimizer for vectorization