Added a constant instead of calling vector.size() each iteration.