Vector update
lots of pattern matching logic