Refactored iteration through vectors