ex2: vectorization