First stage of replacing vectors with arrays
Final version of optimizations