Add documentation and remove superfluous code from C++ sources.