some refactoring of vecwrapper