Refactored invert vector