Code refactoring for skeleton generation in C++ and Java, and a bit of clean-up