Vectorizing code