Change the array to vector +optimizations