taking vector declarations out of for loops