C++ port complete.
Added namespacing.