Replace primitive array with vector, and pass it by reference.