Refactoring custom C++ to namespace