Refactor to-vector fn.