Cleaned up the pre-initialization C++ code somewhat