Refactor a few functions in the Vectorizer module