Fixed memory corruption by reading outside vector
Use C++ anonymous namespace instead of C static keyword
Fixes #2 - merge padding
added unit test on merge_padding