improved vectorization util.