Final part of refactoring the convert2vector code.