Fixed memory corruption by reading outside vector
Use C++ anonymous namespace instead of C static keyword